Browse Source

mod: code

Ben 9 months ago
parent
commit
e29b412449
2 changed files with 5 additions and 5 deletions
  1. 1 1
      js/youtube/index.html
  2. 4 4
      js/youtube/youtubev2.js

+ 1 - 1
js/youtube/index.html

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

+ 4 - 4
js/youtube/youtubev2.js

@@ -340,13 +340,13 @@ detail = async (url, platform) => {
             }
         }
 
-        let formatIds = [];
         const formats = [];
+        const qualities = [];
         for (let format of originFormats) {
             if (printable(platform)) {
                 console.log(format);
             }
-            if (format && formatIds.indexOf(format['itag']) === -1) {
+            if (format && qualities.indexOf(format['qualityLabel']) === -1) {
                 if (!format["url"]) {
                     format["url"] = await signUrl(format["signatureCipher"], baseJsUrl, platform);
                 }
@@ -375,7 +375,7 @@ detail = async (url, platform) => {
                             current["source"] = format
                         }
                         formats.push(current)
-                        formatIds.push(format["itag"]);
+                        qualities.push(format["qualityLabel"]);
                     } else if (vcodec && !acodec) {
                         const current = {
                             "width": format["width"] + "",
@@ -399,7 +399,7 @@ detail = async (url, platform) => {
                             current["source"] = format
                         }
                         formats.push(current)
-                        formatIds.push(format["itag"]);
+                        qualities.push(format["qualityLabel"]);
                     }
                 }
             }