|
@@ -141,7 +141,7 @@ findFunction = (jsCode, regexp, platform) => {
|
|
|
if (existDependencies.includes(varName)) {
|
|
|
continue
|
|
|
}
|
|
|
- if (!/^[$A-Z]+$/.test(varName)) {
|
|
|
+ if (!/^[$A-Z][A-Z|a-z]+$/.test(varName)) {
|
|
|
continue
|
|
|
}
|
|
|
let reg = "var (\$)?" + varName + "={(.|\\n)*?};"
|
|
@@ -326,6 +326,20 @@ detail = async (url, platform) => {
|
|
|
console.log(`after html, format size:${originFormats.length}`);
|
|
|
|
|
|
const baseJsUrl = `https://www.youtube.com${JSON.parse(html.match(/set\(({.+?})\);/)[1])["PLAYER_JS_URL"]}`
|
|
|
+ let audioUrl = ""
|
|
|
+ for (let format of originFormats) {
|
|
|
+ if (!format["url"]) {
|
|
|
+ format["url"] = await signUrl(format["signatureCipher"], baseJsUrl, platform);
|
|
|
+ }
|
|
|
+ if (format["url"]) {
|
|
|
+ const {vcodec, acodec} = parseCodecs(format)
|
|
|
+ if (!vcodec && acodec) {
|
|
|
+ audioUrl = format["url"]
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let formatIds = [];
|
|
|
const formats = [];
|
|
|
for (let format of originFormats) {
|
|
@@ -354,7 +368,8 @@ detail = async (url, platform) => {
|
|
|
"vbr": "0",
|
|
|
"abr": "0",
|
|
|
"container": "mp4_dash",
|
|
|
- "from": format["from"]
|
|
|
+ "from": format["from"],
|
|
|
+ "audioUrl": audioUrl
|
|
|
}
|
|
|
if (platform === "WEB") {
|
|
|
current["source"] = format
|