|
@@ -179,24 +179,26 @@ detail = async (url, requestId, platform) => {
|
|
|
const apiResp = await request('POST', apiUrl, JSON.stringify({
|
|
|
"context": {
|
|
|
"client": {
|
|
|
- "hl": "en",
|
|
|
- "osName": "iPhone",
|
|
|
- "osVersion": "17.5.1.21F90",
|
|
|
- "timeZone": "UTC",
|
|
|
- "userAgent": "com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)",
|
|
|
- "gl": "US",
|
|
|
- "utcOffsetMinutes": 0
|
|
|
+ "clientVersion": "19.29.37",
|
|
|
+ "androidSdkVersion": 30,
|
|
|
+ "clientName": "ANDROID",
|
|
|
+ "osName": "android",
|
|
|
+ "osVersion": "11",
|
|
|
+ "userAgent": "com.google.android.youtube/19.29.37 (Linux; U; Android 11) gzip"
|
|
|
}
|
|
|
},
|
|
|
- "videoId": url.replace('https://www.youtube.com/watch?v=', '')
|
|
|
+ "videoId": url.replace('https://www.youtube.com/watch?v=', ''),
|
|
|
+ "playbackContext": {
|
|
|
+ "contentPlaybackContext": {
|
|
|
+ "html5Preference": "HTML5_PREF_WANTS"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "params": "2AMB"
|
|
|
}), {
|
|
|
- 'Host': 'www.youtube.com',
|
|
|
- 'Connection': 'keep-alive',
|
|
|
- 'User-Agent': 'com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)',
|
|
|
- 'Accept-Language': 'en-US,en',
|
|
|
- 'Cookie': parseSetCookie(htmlHeaders),
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- 'X-YouTube-Client-Version': '19.29.1'
|
|
|
+ 'Origin': "https://www.youtube.com",
|
|
|
+ 'X-YouTube-Client-Version': '19.29.37',
|
|
|
+ 'User-Agent': 'com.google.android.youtube/19.29.37 (Linux; U; Android 11) gzip',
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
}, requestId, platform);
|
|
|
let {data: apiData, _} = apiResp;
|
|
|
console.log(`android api result: ${JSON.stringify(apiResp)}`);
|
|
@@ -243,7 +245,7 @@ detail = async (url, requestId, platform) => {
|
|
|
if (format && itags.indexOf(format['itag']) === -1) {
|
|
|
if (format["url"]) {
|
|
|
const {vcodec, acodec} = parseCodecs(format)
|
|
|
- if (acodec) {
|
|
|
+ if (acodec && vcodec) {
|
|
|
const current = {
|
|
|
"width": format["width"] + "",
|
|
|
"height": format["height"] + "",
|