|
@@ -86,6 +86,7 @@ getUrlFromSignature = (signatureCipher, baseContent) => {
|
|
const decipher = getDecipherFunction(baseContent);
|
|
const decipher = getDecipherFunction(baseContent);
|
|
const searchParams = new URLSearchParams(signatureCipher);
|
|
const searchParams = new URLSearchParams(signatureCipher);
|
|
const [url, signature, sp] = [searchParams.get("url"), searchParams.get("s"), searchParams.get("sp")];
|
|
const [url, signature, sp] = [searchParams.get("url"), searchParams.get("s"), searchParams.get("sp")];
|
|
|
|
+ console.log(signatureCipher, url, signature, sp);
|
|
return `${url}&${sp}=${decipher(signature)}`;
|
|
return `${url}&${sp}=${decipher(signature)}`;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -95,6 +96,7 @@ getDecipherFunction = (string) => {
|
|
const beginningOfFunction =
|
|
const beginningOfFunction =
|
|
"var " + getStringBetween(top, `a=a.split("")`, "(", 10, 1).split(".")[0] + "=";
|
|
"var " + getStringBetween(top, `a=a.split("")`, "(", 10, 1).split(".")[0] + "=";
|
|
const side = getStringBetween(js, beginningOfFunction, "};", 2, -beginningOfFunction.length);
|
|
const side = getStringBetween(js, beginningOfFunction, "};", 2, -beginningOfFunction.length);
|
|
|
|
+ console.log(side + top);
|
|
return eval(side + top);
|
|
return eval(side + top);
|
|
};
|
|
};
|
|
|
|
|
|
@@ -136,25 +138,29 @@ detail = async (url, local) => {
|
|
const formats = []
|
|
const formats = []
|
|
for (let format of [].concat(ytInitialPlayerResponse["streamingData"]["formats"]).concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
|
|
for (let format of [].concat(ytInitialPlayerResponse["streamingData"]["formats"]).concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
|
|
console.log(format);
|
|
console.log(format);
|
|
- format.url = getUrlFromSignature(format["signatureCipher"], baseContent);
|
|
|
|
- const {vcodec, acodec} = parseCodecs(format)
|
|
|
|
- if (vcodec && acodec) {
|
|
|
|
- formats.push({
|
|
|
|
- "width": format["width"] + "",
|
|
|
|
- "height": format["height"] + "",
|
|
|
|
- "type": format["mimeType"],
|
|
|
|
- "quality": format["quality"],
|
|
|
|
- "itag": format["itag"],
|
|
|
|
- "fps": format["fps"] + "",
|
|
|
|
- "bitrate": format["bitrate"] + "",
|
|
|
|
- "url": format["url"],
|
|
|
|
- "ext": "mp4",
|
|
|
|
- "vcodec": vcodec,
|
|
|
|
- "acodec": acodec,
|
|
|
|
- "vbr": "0",
|
|
|
|
- "abr": "0",
|
|
|
|
- "container": "mp4_dash"
|
|
|
|
- })
|
|
|
|
|
|
+ if (!format["url"]) {
|
|
|
|
+ format["url"] = getUrlFromSignature(format["signatureCipher"], baseContent);
|
|
|
|
+ }
|
|
|
|
+ if (format["url"]) {
|
|
|
|
+ const {vcodec, acodec} = parseCodecs(format)
|
|
|
|
+ if (vcodec && acodec) {
|
|
|
|
+ formats.push({
|
|
|
|
+ "width": format["width"] + "",
|
|
|
|
+ "height": format["height"] + "",
|
|
|
|
+ "type": format["mimeType"],
|
|
|
|
+ "quality": format["quality"],
|
|
|
|
+ "itag": format["itag"],
|
|
|
|
+ "fps": format["fps"] + "",
|
|
|
|
+ "bitrate": format["bitrate"] + "",
|
|
|
|
+ "url": format["url"],
|
|
|
|
+ "ext": "mp4",
|
|
|
|
+ "vcodec": vcodec,
|
|
|
|
+ "acodec": acodec,
|
|
|
|
+ "vbr": "0",
|
|
|
|
+ "abr": "0",
|
|
|
|
+ "container": "mp4_dash"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|