Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Youtube-dl library and ERROR 403: Forbidden when using generated direct link by youtube-dl from different locations #6616
Comments
|
Final download URLs are only guaranteed to work on the same machine/IP where extracted. More on this. |
|
Thank you! Sorry I didn't find it there. |
|
In addition, you can probably track URLs that won't work from another IP using this approach in order to apply different logic/scenario for them. |
|
Cookies and user agent there don't play any role as I tried to download video using wget -O file.mp4 "{link}", it worked fine on the same server but didn't work on others. I will code simple relay on the server for downloading using -o - option. Thank you again! |
|
how did u solve this problem . please help me to resolve this isssue |
|
I had to make it download from the same server where it makes requests for details |
I have a problem with youtube-dl library (https://rg3.github.io/youtube-dl/). I use youtube-dl not for directly downloading videos by this library, instead I first generate link using command like this:
youtube-dl --simulate --dump-json --prefer-ffmpeg -- -CmadmM5cOk
I get needed format link from json answer, I use default format 1280x720 mp4. Links look like this "https://r4---sn-nto52nx-px8e.googlevideo.com/videoplayback?lmt=1432339993780507&ip=x.x.x.x&key=yt6&fexp=9408710%2C9409069%2C9413137%2C9415365%2C9415485%2C9416023%2C9416126%2C941...".
Then I use this link to download video from different PC in different locations. For most links it works ok, but there are some videos, for example https://www.youtube.com/watch?v=-CmadmM5cOk, that I can't download from different server or PC, it returns ERROR 403: Forbidden.
So what I tried so far, I have 2 server and my local PC, all 3 of them are located in different countries, USA, England and Ukraine.
For example, I run youtube-dl and get link on Server 1 in the USA, I get link, I can it download in this Sever 1, but on Server 2 in London and my local PC in Ukraine it returns ERROR 403: Forbidden.
Another example, I generate link on Server 2 in London, I get different link, I can download it on the same server, but when I try on Server 1 or my local PC I get the same ERROR 403: Forbidden. The same when I generate link on local PC and try on servers.
This happens only with only some exact videos, but there are a lot of them. Some of videos that returns 403: https://www.youtube.com/watch?v=09R8_2nJtjg, https://www.youtube.com/watch?v=7PCkvCPvDXk.
Thank you, I appreciate any help!