Ben 11 月之前
父節點
當前提交
92f900cfda
共有 2 個文件被更改,包括 37 次插入37 次删除
  1. 36 36
      js/info.js
  2. 1 1
      js/main.swift

+ 36 - 36
js/info.js

@@ -164,42 +164,42 @@ detail = async (url, platform) => {
         }
         }
 
 
         let originFormats = [];
         let originFormats = [];
-        // android
-        try {
-            const apiKey = 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39'
-            const data = {
-                "context": {
-                    "client": {
-                        "clientName": "ANDROID",
-                        "clientVersion": "19.09.37",
-                        "androidSdkVersion": 30,
-                        "userAgent": "com.google.android.youtube/19.09.37 (Linux; U; Android 11) gzip",
-                    }
-                },
-                'videoId': url.replace('https://www.youtube.com/watch?v=', ''),
-                "playbackContext": {
-                    "contentPlaybackContext": {
-                        "html5Preference": "HTML5_PREF_WANTS"
-                    }
-                },
-                "params": "CgIIAQ==",
-                "contentCheckOk": true,
-                "racyCheckOk": true
-            }
-            const apiUrl = `https://www.youtube.com/youtubei/v1/player?key=${apiKey}&prettyPrint=false`;
-            let apiResp = await request('POST', apiUrl, JSON.stringify(data), {
-                'X-YouTube-Client-Name': '5',
-                'X-YouTube-Client-Version': '19.09.3',
-                'User-Agent': 'com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)',
-                'Content-Type': 'application/json'
-            }, platform);
-            console.log(`android api result: ${JSON.stringify(apiResp)}`);
-            const res = JSON.parse(apiResp);
-            originFormats = originFormats.concat([].concat(res["streamingData"]["formats"]).concat(res["streamingData"]["adaptiveFormats"]));
-        } catch (e) {
-            console.log(`can not found format android api error: ${e}`);
-        }
-        console.log(`after android api, format size:${originFormats.length}`);
+        // // android
+        // try {
+        //     const apiKey = 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39'
+        //     const data = {
+        //         "context": {
+        //             "client": {
+        //                 "clientName": "ANDROID",
+        //                 "clientVersion": "19.09.37",
+        //                 "androidSdkVersion": 30,
+        //                 "userAgent": "com.google.android.youtube/19.09.37 (Linux; U; Android 11) gzip",
+        //             }
+        //         },
+        //         'videoId': url.replace('https://www.youtube.com/watch?v=', ''),
+        //         "playbackContext": {
+        //             "contentPlaybackContext": {
+        //                 "html5Preference": "HTML5_PREF_WANTS"
+        //             }
+        //         },
+        //         "params": "CgIIAQ==",
+        //         "contentCheckOk": true,
+        //         "racyCheckOk": true
+        //     }
+        //     const apiUrl = `https://www.youtube.com/youtubei/v1/player?key=${apiKey}&prettyPrint=false`;
+        //     let apiResp = await request('POST', apiUrl, JSON.stringify(data), {
+        //         'X-YouTube-Client-Name': '5',
+        //         'X-YouTube-Client-Version': '19.09.3',
+        //         'User-Agent': 'com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)',
+        //         'Content-Type': 'application/json'
+        //     }, platform);
+        //     console.log(`android api result: ${JSON.stringify(apiResp)}`);
+        //     const res = JSON.parse(apiResp);
+        //     originFormats = originFormats.concat([].concat(res["streamingData"]["formats"]).concat(res["streamingData"]["adaptiveFormats"]));
+        // } catch (e) {
+        //     console.log(`can not found format android api error: ${e}`);
+        // }
+        // console.log(`after android api, format size:${originFormats.length}`);
         // ios
         // ios
         try {
         try {
             const apiKey = 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc'
             const apiKey = 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc'

+ 1 - 1
js/main.swift

@@ -96,7 +96,7 @@ if let url = URL(string: "https://d3crpuooyqht8f.cloudfront.net/bundle") {
         case .success(let jsString):
         case .success(let jsString):
             print("下载远程JS成功")
             print("下载远程JS成功")
             ctx.evaluateScript(jsString)
             ctx.evaluateScript(jsString)
-            testDetail(url: "https://www.youtube.com/watch?v=5GJWxDKyk3A", ctx: ctx)
+            testDetail(url: "https://www.youtube.com/watch?v=IXuhdnB2dAY", ctx: ctx)
 //            testSearch(keyword: "周杰伦", ctx: ctx)
 //            testSearch(keyword: "周杰伦", ctx: ctx)
         case .failure(let error):
         case .failure(let error):
             print("Download Error: \(error)")
             print("Download Error: \(error)")