Aiden 1 settimana fa
parent
commit
4a5fc0a847

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


+ 18 - 18
js/youtube/test.js

@@ -6,27 +6,27 @@
 //         console.log(e);
 //     })
 
-detail(`https://www.youtube.com/watch?v=vXNKWndeG5Y`, '1111', 'WEB')
-    .then(res => {
-        console.log(res);
-    })
-    .catch(e => {
-        console.log(e);
-    })
-
-// query = "Billboard Pop Songs 2025 Playlist +"
-// search(query, null, "", "WEB")
+// detail(`https://www.youtube.com/watch?v=vXNKWndeG5Y`, '1111', 'WEB')
 //     .then(res => {
 //         console.log(res);
-//
-//         search(query, res["data"]["next"], "", "WEB")
-//             .then(res => {
-//                 console.log(res);
-//             })
-//             .catch(e => {
-//                 console.log(e);
-//             })
 //     })
 //     .catch(e => {
 //         console.log(e);
 //     })
+
+query = "adele"
+search(query, null, "", "WEB")
+    .then(res => {
+        console.log(res);
+
+        // search(query, res["data"]["next"], "", "WEB")
+        //     .then(res => {
+        //         console.log(res);
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //     })
+    })
+    .catch(e => {
+        console.log(e);
+    })

+ 56 - 37
js/youtube/youtubev1.js

@@ -127,31 +127,31 @@ request = async (method, url, data = null, headers = {}, requestId, platform) =>
 }
 
 isLiveContent = video => {
-    const badgets = video["badges"]
-    if (badgets && badgets.length > 0) {
-        for (const badge of badgets) {
-            if (badge["metadataBadgeRenderer"] && badge["metadataBadgeRenderer"]["style"] === "BADGE_STYLE_TYPE_LIVE_NOW") {
-                return true
-            }
-        }
-    }
-    const publishText = video["publishedTimeText"]?.["simpleText"];
-    if (!publishText) {
-        return true
-    }
-    const livePublishTexts = [
-        "直播", // 中文
-        "Stream", // 英语
-        "Diffusé", // 法语
-        "gestreamt", // 德语
-        "Emitido hace", // 西班牙语
-        "Transmitido há"// 西班牙
-    ]
-    for (const liveItem of livePublishTexts) {
-        if (publishText.indexOf(liveItem) >= 0) {
-            return true
-        }
-    }
+    // const badgets = video["badges"]
+    // if (badgets && badgets.length > 0) {
+    //     for (const badge of badgets) {
+    //         if (badge["metadataBadgeRenderer"] && badge["metadataBadgeRenderer"]["style"] === "BADGE_STYLE_TYPE_LIVE_NOW") {
+    //             return true
+    //         }
+    //     }
+    // }
+    // const publishText = video["publishedTimeText"]?.["simpleText"];
+    // if (!publishText) {
+    //     return true
+    // }
+    // const livePublishTexts = [
+    //     "直播", // 中文
+    //     "Stream", // 英语
+    //     "Diffusé", // 法语
+    //     "gestreamt", // 德语
+    //     "Emitido hace", // 西班牙语
+    //     "Transmitido há"// 西班牙
+    // ]
+    // for (const liveItem of livePublishTexts) {
+    //     if (publishText.indexOf(liveItem) >= 0) {
+    //         return true
+    //     }
+    // }
     return false
 }
 
@@ -460,23 +460,42 @@ search = async (keyword, next, requestId, platform) => {
 
             let regex = /var ytInitialData\s*=\s*({.*?});/;
             let match = html.match(regex);
+            let json_str = "";
             if (!match || !match.length) {
-                console.log("can not found ytInitialData");
-                throw new Error('JSON not found: ytInitialData');
+                let reg = /var ytInitialData = '(.*?)';/;
+                match = html.match(reg);
+                if (!match) {
+                    throw new Error('JSON not found: ytInitialData');
+                }
+                json_str = match[1].replace(/\\x([0-9a-fA-F]{2})/g, (_, hex) => {
+                    return String.fromCharCode(parseInt(hex, 16));
+                })
+                    .replace(/\\"/g, '"')
+                // json_str = match[1].replace(/\\x22/g, '"')
+                //     .replace(/\\x5b/g, '[')
+                //     .replace(/\\x5d/g, ']')
+                //     .replace(/\\x7b/g, '{')
+                //     .replace(/\\x7d/g, '}')
+                //     .replace(/\\x27/g, "'")
+                //     .replace(/\\\x3d/g, "=")
+                //     .replace(/\\"/g, '"')
+                //     .replace(/\\\//g, '/')
+            } else {
+                json_str = match[1]
             }
 
-            const ytInitialDataResp = JSON.parse(match[1]);
+            const ytInitialDataResp = JSON.parse(json_str);
             if (printable(platform)) {
                 console.log(ytInitialDataResp);
             }
             const videos = [];
-            const contents = ytInitialDataResp["contents"]?.["twoColumnSearchResultsRenderer"]?.["primaryContents"]?.["sectionListRenderer"]?.["contents"] || []
+            const contents = ytInitialDataResp["contents"]?.["sectionListRenderer"]?.["contents"] || []
             for (const content of contents) {
                 const currentContents = content["itemSectionRenderer"]?.["contents"]
                 if (Array.isArray(currentContents)) {
                     for (const currentContent of currentContents) {
-                        if (currentContent["videoRenderer"]) {
-                            const video = currentContent["videoRenderer"];
+                        if (currentContent["videoWithContextRenderer"]) {
+                            const video = currentContent["videoWithContextRenderer"];
                             if (printable(platform)) {
                                 console.log(video);
                             }
@@ -485,13 +504,13 @@ search = async (keyword, next, requestId, platform) => {
                                     "type": "videoWithContextRenderer",
                                     "data": {
                                         "videoId": video["videoId"],
-                                        "title": video["title"]?.["runs"]?.[0]?.["text"],
+                                        "title": video["headline"]?.["runs"]?.[0]?.["text"],
                                         "thumbnails": video["thumbnail"]?.["thumbnails"],
-                                        "channelName": video["longBylineText"]?.["runs"]?.[0]?.["text"],
-                                        "publishedTimeText": video["publishedTimeText"]?.["simpleText"],
-                                        "viewCountText": video["viewCountText"]?.["simpleText"],
-                                        "shortViewCountText": video["shortViewCountText"]?.["simpleText"],
-                                        "lengthText": video["lengthText"]?.["simpleText"]
+                                        "channelName": video["shortBylineText"]?.["runs"]?.[0]?.["text"],
+                                        "publishedTimeText": video["publishedTimeText"]?.["runs"]?.[0]?.["text"],
+                                        "viewCountText": video["shortViewCountText"]?.["runs"]?.[0]?.["text"],
+                                        "shortViewCountText": video["shortViewCountText"]?.["runs"]?.[0]?.["text"],
+                                        "lengthText": video["lengthText"]?.["accessibility"]?.["accessibilityData"]?.["label"],
                                     }
                                 });
                             }

+ 36 - 14
js/youtube/youtubev2.js

@@ -424,33 +424,55 @@ search = async (keyword, next, requestId, platform) => {
 
             let regex = /var ytInitialData\s*=\s*({.*?});/;
             let match = html.match(regex);
+            let json_str = "";
             if (!match || !match.length) {
-                console.log("can not found ytInitialData");
-                throw new Error('JSON not found: ytInitialData');
+                let reg = /var ytInitialData = '(.*?)';/;
+                match = html.match(reg);
+                if (!match) {
+                    throw new Error('JSON not found: ytInitialData');
+                }
+                json_str = match[1].replace(/\\x([0-9a-fA-F]{2})/g, (_, hex) => {
+                    return String.fromCharCode(parseInt(hex, 16));
+                })
+                    .replace(/\\"/g, '"')
+                // json_str = match[1].replace(/\\x22/g, '"')
+                //     .replace(/\\x5b/g, '[')
+                //     .replace(/\\x5d/g, ']')
+                //     .replace(/\\x7b/g, '{')
+                //     .replace(/\\x7d/g, '}')
+                //     .replace(/\\x27/g, "'")
+                //     .replace(/\\\x3d/g, "=")
+                //     .replace(/\\"/g, '"')
+                //     .replace(/\\\//g, '/')
+            } else {
+                json_str = match[1]
             }
 
-            const ytInitialDataResp = JSON.parse(match[1]);
+            const ytInitialDataResp = JSON.parse(json_str);
             console.log(ytInitialDataResp);
             const videos = [];
-            const contents = ytInitialDataResp["contents"]?.["twoColumnSearchResultsRenderer"]?.["primaryContents"]?.["sectionListRenderer"]?.["contents"] || []
+            const contents = ytInitialDataResp["contents"]?.["sectionListRenderer"]?.["contents"] || []
             for (const content of contents) {
                 const currentContents = content["itemSectionRenderer"]?.["contents"]
                 if (Array.isArray(currentContents)) {
                     for (const currentContent of currentContents) {
-                        if (currentContent["videoRenderer"]) {
-                            const video = currentContent["videoRenderer"];
-                            console.log(video);
+                        if (currentContent["videoWithContextRenderer"]) {
+                            const video = currentContent["videoWithContextRenderer"];
+                            // if (printable(platform)) {
+                            //     console.log(video);
+                            // }
                             if (video && video["videoId"] && video["lengthText"]) {
                                 videos.push({
-                                    "type": "videoWithContextRenderer", "data": {
+                                    "type": "videoWithContextRenderer",
+                                    "data": {
                                         "videoId": video["videoId"],
-                                        "title": video["title"]?.["runs"]?.[0]?.["text"],
+                                        "title": video["headline"]?.["runs"]?.[0]?.["text"],
                                         "thumbnails": video["thumbnail"]?.["thumbnails"],
-                                        "channelName": video["longBylineText"]?.["runs"]?.[0]?.["text"],
-                                        "publishedTimeText": video["publishedTimeText"]?.["simpleText"],
-                                        "viewCountText": video["viewCountText"]?.["simpleText"],
-                                        "shortViewCountText": video["shortViewCountText"]?.["simpleText"],
-                                        "lengthText": video["lengthText"]?.["simpleText"]
+                                        "channelName": video["shortBylineText"]?.["runs"]?.[0]?.["text"],
+                                        "publishedTimeText": video["publishedTimeText"]?.["runs"]?.[0]?.["text"],
+                                        "viewCountText": video["shortViewCountText"]?.["runs"]?.[0]?.["text"],
+                                        "shortViewCountText": video["shortViewCountText"]?.["runs"]?.[0]?.["text"],
+                                        "lengthText": video["lengthText"]?.["accessibility"]?.["accessibilityData"]?.["label"],
                                     }
                                 });
                             }

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