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

Age restriction workaround #365

Closed BelleNottelling closed 5 years ago

BelleNottelling commented 5 years ago

This is simply an updated version of PR #316 that is updated to include the changes requested. I take no credit for actual work tho lol. The main change is now by default it fetches the info using the new URL that allows works age restricted videos as it seems to be fine with other ones too, but just incase it fails I left the old URL in as a fallback option.

This should resolve #293 and allow age restricted videos like https://www.youtube.com/watch?v=owUZUdyRVcQ to run correctly.

As an example, http://www.youtube.com/get_video_info?&video_id=owUZUdyRVcQ&asv=3&el=detailpage&hl=en_US returns status=fail&reason=Sign+in+to+confirm+your+age&errordetail=1&errorcode=150

while the alternative url https://www.youtube.com/get_video_info?&video_id=owUZUdyRVcQ&asv=3&hl=en_US returns a valid response with no errors. Fetches using this ^ by default now.

edit: Please do a merge squash. This really should have been only one commit! edit: Here's the video ID to test: owUZUdyRVcQ


This change is Reviewable

BelleNottelling commented 5 years ago

Hey @Art4 would you mind checking the current version?

falahati commented 5 years ago

Just a note: There seems to be a problem with this indentation method used with this PR. Made it hard to read the code on Github. VSCode shows it alright tho.

https://github.com/jeckman/YouTube-Downloader/blob/master/src/Provider/Youtube/Provider.php#L153