commit
63517859b3
@ -112,12 +112,12 @@ export class SeekStream {
|
|||||||
this.request = stream;
|
this.request = stream;
|
||||||
stream.pipe(this.stream, { end: false });
|
stream.pipe(this.stream, { end: false });
|
||||||
|
|
||||||
this.stream.once("headComplete", () => {
|
this.stream.once('headComplete', () => {
|
||||||
stream.unpipe(this.stream)
|
stream.unpipe(this.stream);
|
||||||
stream.destroy()
|
stream.destroy();
|
||||||
this.stream.state = WebmSeekerState.READING_DATA
|
this.stream.state = WebmSeekerState.READING_DATA;
|
||||||
res('')
|
res('');
|
||||||
})
|
});
|
||||||
} else res('');
|
} else res('');
|
||||||
}).catch((err) => err);
|
}).catch((err) => err);
|
||||||
if (parse instanceof Error) {
|
if (parse instanceof Error) {
|
||||||
|
|||||||
@ -79,6 +79,7 @@ export class WebmSeeker extends Duplex {
|
|||||||
let position = 0;
|
let position = 0;
|
||||||
const time = Math.floor(sec / 10) * 10;
|
const time = Math.floor(sec / 10) * 10;
|
||||||
this.time_left = (sec - time) * 1000 || 0;
|
this.time_left = (sec - time) * 1000 || 0;
|
||||||
|
this.time_left = Math.round(this.time_left / 20) * 20;
|
||||||
if (!this.header.segment.cues) return new Error('Failed to Parse Cues');
|
if (!this.header.segment.cues) return new Error('Failed to Parse Cues');
|
||||||
|
|
||||||
for (const data of this.header.segment.cues) {
|
for (const data of this.header.segment.cues) {
|
||||||
@ -131,9 +132,9 @@ export class WebmSeeker extends Duplex {
|
|||||||
if (ebmlID.name === 'ebml') this.headfound = true;
|
if (ebmlID.name === 'ebml') this.headfound = true;
|
||||||
else return new Error('Failed to find EBML ID at start of stream.');
|
else return new Error('Failed to find EBML ID at start of stream.');
|
||||||
}
|
}
|
||||||
if(ebmlID.name === "cluster") {
|
if (ebmlID.name === 'cluster') {
|
||||||
this.emit("headComplete")
|
this.emit('headComplete');
|
||||||
this.cursor = this.chunk.length
|
this.cursor = this.chunk.length;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const data = this.chunk.slice(
|
const data = this.chunk.slice(
|
||||||
|
|||||||
@ -205,20 +205,17 @@ export async function video_basic_info(url: string, options: InfoOptions = {}):
|
|||||||
?.metadataRowContainer?.metadataRowContainerRenderer?.rows;
|
?.metadataRowContainer?.metadataRowContainerRenderer?.rows;
|
||||||
const music: any[] = [];
|
const music: any[] = [];
|
||||||
if (musicInfo) {
|
if (musicInfo) {
|
||||||
let incompleteInfo: any = {};
|
|
||||||
musicInfo.forEach((x: any) => {
|
musicInfo.forEach((x: any) => {
|
||||||
if (!x.metadataRowRenderer) return;
|
if (!x.metadataRowRenderer) return;
|
||||||
if (x.metadataRowRenderer.title.simpleText.toLowerCase() === 'song') {
|
if (x.metadataRowRenderer.title.simpleText.toLowerCase() === 'song') {
|
||||||
music.push(incompleteInfo);
|
music.push({});
|
||||||
incompleteInfo = {};
|
music[music.length - 1].song =
|
||||||
incompleteInfo.song =
|
|
||||||
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
||||||
} else
|
} else
|
||||||
incompleteInfo[x.metadataRowRenderer.title.simpleText.toLowerCase()] =
|
music[music.length - 1][x.metadataRowRenderer.title.simpleText.toLowerCase()] =
|
||||||
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
music.shift();
|
|
||||||
const video_details = new YouTubeVideo({
|
const video_details = new YouTubeVideo({
|
||||||
id: vid.videoId,
|
id: vid.videoId,
|
||||||
title: vid.title,
|
title: vid.title,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user