yemingfeng 4 months ago
parent
commit
f127a483fa
2 changed files with 1 additions and 2 deletions
  1. 0 1
      js/youtube/youtubev1.js
  2. 1 1
      js/youtube/youtubev2.js

+ 0 - 1
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]);

+ 1 - 1
js/youtube/youtubev2.js

@@ -301,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": {