jeckman / YouTube-Downloader

PHP script for downloading videos from youtube; also parsing youtube feed into RSS enclosures for podcatchers
GNU General Public License v2.0
895 stars 474 forks source link

fix format retrieval when no url_encoded_fmt_stream_map nor adaptive_fmt exist #431

Closed mhama closed 4 years ago

mhama commented 4 years ago

About

This PR fixes recent failure in handling formats of youtube. When it hit the error, it shows "Youtube Downloader Error / No format stream map found - was the video id correct?" (Other error may show the same screen, though)

Root cause

The root cause is that the value which returned by http://www.youtube.com/get_video_info?video_id=... does not have the key "url_encoded_fmt_stream_map" and "adaptive_fmt", which current code uses to retrieve streaming formats.

Solution

There's other information which we can use, and it is inside 'player_response' parameter. player_response['streamingData']['formats'], and player_response['streamingData']['adaptiveFormats'] does have the equivalent information.

I didn't verify every parameter actually, but it works now.

See

https://github.com/ytdl-org/youtube-dl/commit/bf1317d257d13188601c837c983830355c6203e5