Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube-dl library and ERROR 403: Forbidden when using generated direct link by youtube-dl from different locations #6616

Closed
vedmant opened this issue Aug 19, 2015 · 6 comments

Comments

@vedmant
Copy link

@vedmant vedmant commented Aug 19, 2015

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!

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 19, 2015

Final download URLs are only guaranteed to work on the same machine/IP where extracted. More on this.

@dstftw dstftw closed this Aug 19, 2015
@vedmant
Copy link
Author

@vedmant vedmant commented Aug 19, 2015

Thank you! Sorry I didn't find it there.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 19, 2015

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.

@vedmant
Copy link
Author

@vedmant vedmant commented Aug 19, 2015

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!

@moktarul12
Copy link

@moktarul12 moktarul12 commented Sep 22, 2016

how did u solve this problem . please help me to resolve this isssue

@vedmant
Copy link
Author

@vedmant vedmant commented Sep 22, 2016

I had to make it download from the same server where it makes requests for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.