Ben преди 9 месеца
родител
ревизия
e29b412449
променени са 2 файла, в които са добавени 5 реда и са изтрити 5 реда
  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>
 <head>
     <meta charset="UTF-8">
     <meta charset="UTF-8">
     <title>JavaScript in Browser</title>
     <title>JavaScript in Browser</title>
-    <script src="youtube.js"></script>
+    <script src="youtubev2.js"></script>
     <script src="test.js"></script>
     <script src="test.js"></script>
 </head>
 </head>
 </html>
 </html>

+ 4 - 4
js/youtube/youtubev2.js

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