Handle private videos, use iOS client
This commit is contained in:
1 parent
11d1aef201
commit
1ff96223a5
2 files changed
+12
-1
No files matched your search
@@ -178,7 +178,13 @@ export class YoutubeJs {
|
|||||||
|
|
||||||
static async getVideoInfo(videoId: string) {
|
static async getVideoInfo(videoId: string) {
|
||||||
await this.init();
|
await this.init();
|
||||||
const info = await YoutubeJs.innerTube.getBasicInfo(videoId, 'ANDROID');
|
const info = await YoutubeJs.innerTube.getBasicInfo(videoId, 'IOS');
|
||||||
|
|
||||||
|
console.log('[YTJS] info:', info);
|
||||||
|
|
||||||
|
if (info.playability_status.status !== 'OK') {
|
||||||
|
throw new Error(`Video not available: ${info.playability_status.reason}`);
|
||||||
|
}
|
||||||
|
|
||||||
const formatStreams = info.streaming_data.formats.map(format => {
|
const formatStreams = info.streaming_data.formats.map(format => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
async function playOnTvHotFix() {
|
async function playOnTvHotFix() {
|
||||||
// measure length of time it takes to get video info
|
// measure length of time it takes to get video info
|
||||||
|
try {
|
||||||
const start = performance.now();
|
const start = performance.now();
|
||||||
const videoInfo = await YoutubeJs.getVideoInfo(videoId);
|
const videoInfo = await YoutubeJs.getVideoInfo(videoId);
|
||||||
const end = performance.now();
|
const end = performance.now();
|
||||||
@@ -53,6 +54,10 @@
|
|||||||
|
|
||||||
await YoutubeJs.postCacheData(videoInfo);
|
await YoutubeJs.postCacheData(videoInfo);
|
||||||
await playOnTv();
|
await playOnTv();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
alert(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function queueOnTv() {
|
async function queueOnTv() {
|
||||||
|
|||||||
Reference in new issue
Block a user