refactor!: overhaul core classes and remove redundant code (#388)

* feat(Player.ts): append `cver` to deciphered URLs

* refactor(Actions.ts): remove redundant `getVideoInfo` function

This is leftover code from previous versions. It had many problems and it is no longer required.

* fix(Kids.ts): remove unneeded `await` keywords

* dev: add more endpoints

* chore: update deps

* refactor: separate endpoints into files

* dev: improve types

* dev: add more endpoints

* refactor: put clients in a separate directory inside `core`

* chore: lint

* refactor: move mixins and managers to separate folders

* chore: fix tests

* dev: add `CreateVideoEndpoint`

* chore: clean up

* chore: lint

* chore: add some comments

* chore: remove unnecessary test

* dev: add `playlist/CreateEndpoint`

* dev: add `playlist/DeleteEndpoint`

* dev: add `browse/EditPlaylistEndpoint`

* fix(parser): add a few checks to avoid parsing errors
This commit is contained in:
LuanRT
2023-04-28 19:01:04 -03:00
committed by GitHub
parent 22ae6c93ee
commit 95e0294eab
83 changed files with 1524 additions and 705 deletions

View File

@@ -1,5 +1,5 @@
import { createWriteStream, existsSync } from 'node:fs';
import { Innertube, IBrowseResponse, TabbedFeed, Utils, YT, YTMusic, YTNodes } from '../bundle/node.cjs';
import { Innertube, IBrowseResponse, Utils, YT, YTMusic, YTNodes } from '../bundle/node.cjs';
describe('YouTube.js Tests', () => {
let innertube: Innertube;
@@ -94,11 +94,6 @@ describe('YouTube.js Tests', () => {
expect(home_feed.contents.contents?.length).toBeGreaterThan(0);
});
test('HomeFeed#applyFilter', async () => {
const filtered_home_feed = await home_feed.applyFilter(home_feed.filter_chips[1]);
expect(filtered_home_feed.contents.contents?.length).toBeGreaterThan(0);
});
test('HomeFeed#getContinuation', async () => {
const incremental_continuation = await home_feed.getContinuation();
expect(incremental_continuation.contents).toBeDefined();
@@ -118,7 +113,7 @@ describe('YouTube.js Tests', () => {
expect(trending).toBeDefined();
expect(trending.page.contents).toBeDefined();
expect(trending.page.contents_memo).toBeDefined();
expect(trending.videos.length).toBeGreaterThan(0); TabbedFeed<IBrowseResponse>;
expect(trending.videos.length).toBeGreaterThan(0);
});
describe('Innertube#getChannel', () => {