|
@@ -182,7 +182,7 @@ detail = async (url, platform) => {
|
|
|
console.log(`android api result: ${JSON.stringify(apiResp)}`);
|
|
|
const res = JSON.parse(apiData);
|
|
|
const currentFormats = [];
|
|
|
- for (const format of [].concat(res["streamingData"]["formats"]).concat(res["streamingData"]["adaptiveFormats"])) {
|
|
|
+ for (const format of [].concat(res["streamingData"]["formats"] || []).concat(res["streamingData"]["adaptiveFormats"] || [])) {
|
|
|
if (format) {
|
|
|
format["from"] = "android"
|
|
|
currentFormats.push(format);
|
|
@@ -201,15 +201,15 @@ detail = async (url, platform) => {
|
|
|
console.log(`after android api, format size:${originFormats.length}`);
|
|
|
|
|
|
// web
|
|
|
- const currentFormats = [];
|
|
|
- for (const format of ytInitialPlayerResponse["streamingData"]["formats"].concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
|
|
|
- if (format) {
|
|
|
- format["from"] = "web"
|
|
|
- currentFormats.push(format);
|
|
|
- }
|
|
|
- }
|
|
|
- originFormats = originFormats.concat(currentFormats);
|
|
|
- console.log(`after html, format size:${originFormats.length}`);
|
|
|
+ // const currentFormats = [];
|
|
|
+ // for (const format of ytInitialPlayerResponse["streamingData"]["formats"].concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
|
|
|
+ // if (format) {
|
|
|
+ // format["from"] = "web"
|
|
|
+ // currentFormats.push(format);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // originFormats = originFormats.concat(currentFormats);
|
|
|
+ // console.log(`after html, format size:${originFormats.length}`);
|
|
|
|
|
|
let qualities = [];
|
|
|
const formats = [];
|