Ben 9 mesi fa
parent
commit
b18f112144

File diff suppressed because it is too large
+ 0 - 0
js/pornhub.bundle.js


File diff suppressed because it is too large
+ 0 - 0
js/tiktok.bundle.js


File diff suppressed because it is too large
+ 0 - 0
js/xvideos.bundle.js


File diff suppressed because it is too large
+ 0 - 0
js/youtube.bundle.js


+ 1 - 1
js/youtube/test.js

@@ -1,4 +1,4 @@
-detail(`https://www.youtube.com/watch?v=DYptgVvkVLQ`, 'WEB')
+detail(`https://www.youtube.com/watch?v=sgEJ4sOwboM`, 'WEB')
     .then(res => {
         console.log(res);
     })

+ 16 - 13
js/youtube/youtubev2.js

@@ -26,7 +26,7 @@ parseCodecs = (format) => {
     for (const fullCodec of splitCodecs) {
         const codec = fullCodec.split('.')[0];
 
-        if (['avc1', 'avc2', 'avc3', 'avc4', 'vp9', 'vp8', 'hev1', 'hev2', 'h263', 'h264', 'mp4v', 'hvc1', 'av01', 'theora'].includes(codec)) {
+        if (['avc1', 'avc2', 'avc3', 'avc4', 'hev1', 'hev2', 'h263', 'h264', 'mp4v', 'hvc1', 'av01', 'theora'].includes(codec)) {
             if (!vcodec) {
                 vcodec = fullCodec;
             }
@@ -86,8 +86,8 @@ parseSetCookie = (headers) => {
 
 request = async (method, url, data = null, headers = {}, platform) => {
     if (platform === "WEB") {
-        url = url.replace("https://www.youtube.com/", "http://127.0.0.1:80/");
-        url = url.replace("https://music.youtube.com/", "http://127.0.0.1:80/");
+        url = url.replace("https://www.youtube.com/", "http://16.162.163.175:80/");
+        url = url.replace("https://music.youtube.com/", "http://16.162.163.175:80/");
     }
     console.log(`request url:${url}`)
     console.log(`request data:${data}`)
@@ -181,7 +181,7 @@ detail = async (url, platform) => {
             console.log(`android api result: ${JSON.stringify(apiResp)}`);
             const res = JSON.parse(apiData);
             const currentFormats = [];
-            for (const format of [].concat(res["streamingData"]["formats"]).concat(res["streamingData"]["adaptiveFormats"])) {
+            for (const format of [].concat(res["streamingData"]["formats"] || []).concat(res["streamingData"]["adaptiveFormats"] || [])) {
                 if (format) {
                     format["from"] = "android"
                     currentFormats.push(format);
@@ -200,15 +200,15 @@ detail = async (url, platform) => {
         console.log(`after android api, format size:${originFormats.length}`);
 
         // web
-        const currentFormats = [];
-        for (const format of ytInitialPlayerResponse["streamingData"]["formats"].concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
-            if (format) {
-                format["from"] = "web"
-                currentFormats.push(format);
-            }
-        }
-        originFormats = originFormats.concat(currentFormats);
-        console.log(`after html, format size:${originFormats.length}`);
+        // const currentFormats = [];
+        // for (const format of ytInitialPlayerResponse["streamingData"]["formats"].concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
+        //     if (format) {
+        //         format["from"] = "web"
+        //         currentFormats.push(format);
+        //     }
+        // }
+        // originFormats = originFormats.concat(currentFormats);
+        // console.log(`after html, format size:${originFormats.length}`);
 
         let audioUrl = ""
         for (let format of originFormats) {
@@ -227,6 +227,9 @@ detail = async (url, platform) => {
             if (printable(platform)) {
                 console.log(format);
             }
+            if (format["height"] && parseInt(format["height"]) > 720) {
+                continue
+            }
             if (format && qualities.indexOf(format['qualityLabel']) === -1) {
                 if (format["url"]) {
                     const {vcodec, acodec} = parseCodecs(format)

File diff suppressed because it is too large
+ 0 - 0
js/youtube_audio.bundle.js


Some files were not shown because too many files changed in this diff