mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 04:21:35 +00:00
refactor!: cleanup platform support (#306)
* refactor!: cleanup platform support * chore: lint * fix: web platform * feat: provide UniversalCache Provide UniversalCache as a wrapper around Platform.shim.Cache. * fix: invalid import * refactor: remove isolated-vm support * fix: type info * refactor: cleanup exports * fix: mark jintr as external dependency In the bundled CJS node build, mark jintr as external. * chore: add additional exports web exports provide a way to select web implementation manually without relying on the bundler to select it correctly from the "exports" field web points to src/platform/web.js web.bundle points to bundle/browser.js web.bundle.browser points to bundle/browser.min.js agnostic exports provide users of the library to provide their own platform implementation without first importing the default one. agnostic points to src/platform/lib.ts * fix: toDash on web * revert: eval is synchronous * fix: use serializeDOM in FormatUtils * ci: automate releases with `release-please` * chore: clean up workflow files * ci: fix NPM publish action --------- Co-authored-by: LuanRT <luan.lrt4@gmail.com>
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import Innertube from '..';
|
||||
import { Innertube, Utils } from '../bundle/node.cjs';
|
||||
import { CHANNELS, VIDEOS } from './constants';
|
||||
import { streamToIterable } from '../src/utils/Utils';
|
||||
import TextRun from '../src/parser/classes/misc/TextRun';
|
||||
import Comments from '../dist/src/parser/youtube/Comments';
|
||||
import type TextRun from '../src/parser/classes/misc/TextRun';
|
||||
|
||||
describe('YouTube.js Tests', () => {
|
||||
let yt: Innertube;
|
||||
@@ -93,7 +91,7 @@ describe('YouTube.js Tests', () => {
|
||||
});
|
||||
|
||||
describe('Comments', () => {
|
||||
let comment_section: Comments;
|
||||
let comment_section: Awaited<ReturnType<(typeof yt)['getComments']>>;
|
||||
|
||||
it('should retrieve comments', async () => {
|
||||
comment_section = await yt.getComments(VIDEOS[1].ID);
|
||||
@@ -279,7 +277,7 @@ async function download(id: string, yt: Innertube): Promise<boolean> {
|
||||
const stream = await yt.download(id, { type: 'video+audio' });
|
||||
const file = fs.createWriteStream(`./${id}.mp4`);
|
||||
|
||||
for await (const chunk of streamToIterable(stream)) {
|
||||
for await (const chunk of Utils.streamToIterable(stream)) {
|
||||
file.write(chunk);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user