1
0

9 Commits f5d7f6d197 ... dabe88b6a4

Autor SHA1 Mensagem Data
  yemingfeng dabe88b6a4 Mod: code há 4 meses atrás
  yemingfeng 4a334e15f5 fix há 4 meses atrás
  yemingfeng f127a483fa fix há 4 meses atrás
  yemingfeng 16dbcdd7d3 fix há 4 meses atrás
  yemingfeng 57517a9874 fix há 4 meses atrás
  yemingfeng 5f6f5aa664 Mod: code há 4 meses atrás
  yemingfeng 5619a431c0 Add: log há 4 meses atrás
  yemingfeng 1bb0d50ce1 Mod: client há 4 meses atrás
  Aiden 69db94eccc mod: apiKey há 4 meses atrás

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/pornhub.bundle.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/tiktok.bundle.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/xvideos.bundle.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/youtube.bundle.js


+ 1 - 1
js/youtube/index.html

@@ -3,7 +3,7 @@
 <head>
     <meta charset="UTF-8">
     <title>JavaScript in Browser</title>
-    <script src="youtubev1.js"></script>
+    <script src="youtubev2.js"></script>
     <script src="test.js"></script>
 </head>
 </html>

+ 19 - 11
js/youtube/youtubev1.js

@@ -144,7 +144,6 @@ detail = async (url, requestId, platform) => {
         if (match) {
             const ytInitialPlayerResponse = JSON.parse(match[1]);
             console.log(ytInitialPlayerResponse);
-            const originVideoDetails = ytInitialPlayerResponse['videoDetails'];
             const ytInitialDataMatch = html.match(/var ytInitialData\s*=\s*({.*?});/);
             if (ytInitialDataMatch && ytInitialDataMatch.length === 2) {
                 const ytInitialData = JSON.parse(ytInitialDataMatch[1]);
@@ -176,23 +175,32 @@ detail = async (url, requestId, platform) => {
         let originFormats = [];
         let originVideoDetails = undefined;
         try {
-            const apiUrl = `https://music.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8`;
+            const apiUrl = `https://www.youtube.com/youtubei/v1/player`;
             const apiResp = await request('POST', apiUrl, JSON.stringify({
                 "context": {
                     "client": {
-                        "clientName": "ANDROID", "hl": "en", "clientVersion": "18.49.37", "gl": "US"
+                        "hl": "en",
+                        "osName": "iPhone",
+                        "osVersion": "17.5.1.21F90",
+                        "timeZone": "UTC",
+                        "userAgent": "com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)",
+                        "gl": "US",
+                        "utcOffsetMinutes": 0
                     }
-                }, "videoId": url.replace('https://www.youtube.com/watch?v=', ''), "params": "CgIQBg"
+                },
+                "videoId": url.replace('https://www.youtube.com/watch?v=', '')
             }), {
                 'Host': 'www.youtube.com',
                 'Connection': 'keep-alive',
-                'User-Agent': 'com.google.android.apps.youtube.music/17.31.35 (Linux; U; Android 11) gzip',
+                'User-Agent': 'com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)',
                 'Accept-Language': 'en-US,en',
                 'Cookie': parseSetCookie(htmlHeaders),
-                'Content-Type': 'application/json'
+                'Content-Type': 'application/json',
+                'X-YouTube-Client-Version': '19.29.1'
             }, requestId, platform);
             let {data: apiData, _} = apiResp;
             console.log(`android api result: ${JSON.stringify(apiResp)}`);
+            console.log(`${JSON.stringify(apiResp)}`);
             const res = JSON.parse(apiData);
             const currentFormats = [];
             originVideoDetails = res["videoDetails"];
@@ -226,16 +234,16 @@ detail = async (url, requestId, platform) => {
             }
         }
 
-        let qualities = [];
+        let itags = [];
         const formats = [];
         for (let format of originFormats) {
             if (printable(platform)) {
                 console.log(format);
             }
-            if (format && qualities.indexOf(format['itag']) === -1) {
+            if (format && itags.indexOf(format['itag']) === -1) {
                 if (format["url"]) {
                     const {vcodec, acodec} = parseCodecs(format)
-                    if (vcodec && acodec) {
+                    if (acodec) {
                         const current = {
                             "width": format["width"] + "",
                             "height": format["height"] + "",
@@ -257,7 +265,7 @@ detail = async (url, requestId, platform) => {
                             "videoUrl": format["url"]
                         }
                         formats.push(current)
-                        qualities.push(format["qualityLabel"]);
+                        itags.push(format["itag"]);
                     }
                 }
             }
@@ -283,7 +291,7 @@ detail = async (url, requestId, platform) => {
             "channelID": originVideoDetails["channelId"],
             "recommendInfo": recommendInfo,
             "channelURL": `https://www.youtube.com/channel/${originVideoDetails["channelId"]}`,
-            "videoId": originVideoDetails["videoId"]
+            "videoId": url.replace('https://www.youtube.com/watch?v=', '')
         }
         const ret = {
             "code": 200,

+ 14 - 6
js/youtube/youtubev2.js

@@ -158,20 +158,28 @@ detail = async (url, requestId, platform) => {
         let originVideoDetails = undefined;
         // android
         try {
-            const apiUrl = `https://music.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8`;
+            const apiUrl = `https://www.youtube.com/youtubei/v1/player`;
             const apiResp = await request('POST', apiUrl, JSON.stringify({
                 "context": {
                     "client": {
-                        "clientName": "ANDROID", "hl": "en", "clientVersion": "18.49.37", "gl": "US"
+                        "hl": "en",
+                        "osName": "iPhone",
+                        "osVersion": "17.5.1.21F90",
+                        "timeZone": "UTC",
+                        "userAgent": "com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)",
+                        "gl": "US",
+                        "utcOffsetMinutes": 0
                     }
-                }, "videoId": url.replace('https://www.youtube.com/watch?v=', ''), "params": "CgIQBg"
+                },
+                "videoId": url.replace('https://www.youtube.com/watch?v=', '')
             }), {
                 'Host': 'www.youtube.com',
                 'Connection': 'keep-alive',
-                'User-Agent': 'com.google.android.apps.youtube.music/17.31.35 (Linux; U; Android 11) gzip',
+                'User-Agent': 'com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)',
                 'Accept-Language': 'en-US,en',
                 'Cookie': parseSetCookie(htmlHeaders),
-                'Content-Type': 'application/json'
+                'Content-Type': 'application/json',
+                'X-YouTube-Client-Version': '19.29.1'
             }, requestId, platform);
             let {data: apiData, _} = apiResp;
             console.log(`android api result: ${JSON.stringify(apiResp)}`);
@@ -293,7 +301,7 @@ detail = async (url, requestId, platform) => {
             "channelID": originVideoDetails["channelId"],
             "recommendInfo": recommendInfo,
             "channelURL": `https://www.youtube.com/channel/${originVideoDetails["channelId"]}`,
-            "videoId": originVideoDetails["videoId"]
+            "videoId": url.replace('https://www.youtube.com/watch?v=', '')
         }
         const ret = {
             "code": 200, "msg": "", "requestId": requestId, "data": {

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff