Skip to content

Commit

Permalink
feat: Add getCourses (#798)
Browse files Browse the repository at this point in the history
* feat: add getCourses function to retrieve courses

* chore: Change getCourses function to return Feed instead of TabbedFeed
  • Loading branch information
YBD Project authored Nov 19, 2024
1 parent 71d9ebc commit cfb48fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Innertube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ export default class Innertube {
return new TabbedFeed(this.actions, response);
}

async getCourses(): Promise<Feed<IBrowseResponse>> {
const response = await this.actions.execute(
BrowseEndpoint.PATH, { ...BrowseEndpoint.build({ browse_id: 'FEcourses_destination' }), parse: true }
);
return new Feed(this.actions, response);
}

async getSubscriptionsFeed(): Promise<Feed<IBrowseResponse>> {
const response = await this.actions.execute(
BrowseEndpoint.PATH, { ...BrowseEndpoint.build({ browse_id: 'FEsubscriptions' }), parse: true }
Expand Down
8 changes: 8 additions & 0 deletions test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ describe('YouTube.js Tests', () => {
expect(trending.videos.length).toBeGreaterThan(0);
});

test('Innertube#getCourses', async () => {
const courses = await innertube.getCourses();
expect(courses).toBeDefined();
expect(courses.page.contents).toBeDefined();
expect(courses.page.contents_memo).toBeDefined();
expect(courses.shelves.length).toBeGreaterThan(0);
});

describe('Innertube#getChannel', () => {
let channel: YT.Channel;

Expand Down

0 comments on commit cfb48fa

Please sign in to comment.