mirror of
https://github.com/LuanRT/googlevideo.git
synced 2026-06-24 07:11:45 +00:00
fix(sabr): Video-only playback is no longer supported
What a bummer... At least they can't remove audio-only, since it's still needed for YouTube Music. :)
This commit is contained in:
@@ -3,7 +3,7 @@ import cliProgress from 'cli-progress';
|
||||
import type { WriteStream } from 'node:fs';
|
||||
import { createWriteStream, unlink } from 'node:fs';
|
||||
import { Innertube, UniversalCache } from 'youtubei.js';
|
||||
import GoogleVideo, { type Format, Protos } from '../../dist/src/index.js';
|
||||
import GoogleVideo, { type Format } from '../../dist/src/index.js';
|
||||
|
||||
const progressBars = new cliProgress.MultiBar({
|
||||
stopOnComplete: true,
|
||||
@@ -121,8 +121,8 @@ await serverAbrStream.init({
|
||||
audioFormats: [ selectedAudioFormat ],
|
||||
videoFormats: [ selectedVideoFormat ],
|
||||
clientAbrState: {
|
||||
mediaType: Protos.MediaType.MEDIA_TYPE_DEFAULT,
|
||||
startTimeMs: 0
|
||||
startTimeMs: 0,
|
||||
mediaType: 0 // 0 = BOTH, 1 = AUDIO (video-only is no longer supported by YouTube)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import cliProgress from 'cli-progress';
|
||||
import type { WriteStream } from 'node:fs';
|
||||
import { createWriteStream } from 'node:fs';
|
||||
import { Innertube, UniversalCache } from 'youtubei.js';
|
||||
import GoogleVideo, { type Format, Protos } from '../../dist/src/index.js';
|
||||
import GoogleVideo, { type Format } from '../../dist/src/index.js';
|
||||
|
||||
const progressBars = new cliProgress.MultiBar({
|
||||
stopOnComplete: true,
|
||||
@@ -130,13 +130,8 @@ await serverAbrStream.init({
|
||||
audioFormats: [ selectedAudioFormat ],
|
||||
videoFormats: [ selectedVideoFormat ],
|
||||
clientAbrState: {
|
||||
/**
|
||||
* MEDIA_TYPE_DEFAULT = 0,
|
||||
* MEDIA_TYPE_AUDIO = 1,
|
||||
* MEDIA_TYPE_VIDEO = 2,
|
||||
*/
|
||||
mediaType: Protos.MediaType.MEDIA_TYPE_DEFAULT,
|
||||
startTimeMs: 0
|
||||
startTimeMs: 0,
|
||||
mediaType: 0 // 0 = BOTH, 1 = AUDIO (video-only is no longer supported by YouTube)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -97,12 +97,12 @@ export class ServerAbrStream extends EventEmitterLike {
|
||||
if (data.sabrError) break;
|
||||
|
||||
const mainFormat =
|
||||
clientAbrState.mediaType === ClientAbrState_MediaType.MEDIA_TYPE_DEFAULT
|
||||
? data.initializedFormats.find((fmt) => fmt.mimeType?.includes('video'))
|
||||
: data.initializedFormats[0];
|
||||
clientAbrState.mediaType === ClientAbrState_MediaType.MEDIA_TYPE_DEFAULT
|
||||
? data.initializedFormats.find((fmt) => fmt.mimeType?.includes('video'))
|
||||
: data.initializedFormats[0];
|
||||
|
||||
for (const fmt of data.initializedFormats) {
|
||||
this.previousSequences.set(`${fmt.formatId.itag};${fmt.formatId.lastModified};`, fmt.sequenceList.map((seq) => seq.sequenceNumber || 0));
|
||||
this.previousSequences.set(fmt.formatKey, fmt.sequenceList.map((seq) => seq.sequenceNumber || 0));
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user