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

video downloads well but its URL does not play in the browser or Media player #2593

Closed
simplyi opened this issue Mar 20, 2014 · 6 comments
Closed

Comments

@simplyi
Copy link

@simplyi simplyi commented Mar 20, 2014

HI guys!

I have downloaded youtube-dl and videos are downloading well when run in command line. However if I run youtube-dl to extract urls only:

./youtube-dl --get-url "https://www.youtube.com/watch?v=iUiTQvT0W_0" --all-formats

and then take one of the urls and try to play in in the browser window I get 403 error code. Video does not play. I tried using same urls with Apple Media player and still the same problem. Video does not play. But It does download if I run:

./youtube-dl

for example. This command will download video well:
./youtube-dl "https://www.youtube.com/watch?v=iUiTQvT0W_0"

This will return url.
./youtube-dl "https://www.youtube.com/watch?v=iUiTQvT0W_0" --get-url

https://r12---sn-q4f7dnsd.googlevideo.com/videoplayback?mv=m&mt=1395347897&gcr=us&ms=au&requiressl=yes&sparams=gcr%2Cid%2Cip%2Cipbits%2Citag%2Cpcm2fr%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AJSdxOK99mRfHZzI6v7Xv-MQBzgJm6E40P5K--GYwcb5&expire=1395371990&ipbits=0&ratebypass=yes&sver=3&itag=18&key=yt5&source=youtube&pcm2fr=yes&ip=54.196.172.2&fexp=907725%2C932273%2C929202%2C916612%2C937417%2C913434%2C936910%2C936913%2C934022&upn=dlGhz_Jw8Qg&signature=110070391B456A89B495E5A322859C64847B33F6.F3E5BA4AB8D5E9B3ADAC75CF1AF77183AE00367D

but If used in the browser, video will not play.

Can you advise?

@simplyi simplyi closed this Mar 20, 2014
@simplyi
Copy link
Author

@simplyi simplyi commented Mar 20, 2014

hmmm... interesting.... if I run these same commands on my MacPro at home it works... but If I run these commands from Amazon EC2 server. Returned URL fails to play in the browser.... what could be the problem? I have updated youtube-dl to a latest version on both machines.

@simplyi simplyi reopened this Mar 20, 2014
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 20, 2014

The urls for some videos may require to use the same cookies that were used to extract them. You can use --cookies the_cookies_file.txt to get them. Anyway, it works fine on my computer without using the cookies.

@jaimeMF jaimeMF closed this Mar 20, 2014
@simplyi
Copy link
Author

@simplyi simplyi commented Mar 20, 2014

@jaimeMF thank you for your reply! I double checked. If I run on local computer it works well. If I run youtube-dl on remote Amazon EC2 instance it does generate urls but then I cannot use then in the browser. The browser is actually just for testing. What I do is I grab one of these urls and run it in iPhone media player. Urls that are generated on local machine works well. Urls that are generated on Amazon EC2 instance do not work.

Also I tried runing youtube-dl script in php:

ob_start();
$command = "/opt/youtube-dl-master/youtube-dl --get-url --all-formats "" . $ut_url . """;
passthru($command);
$output_urls = ob_get_clean();

I get URLs fine. But none of them works.

@xanadu
Copy link
Contributor

@xanadu xanadu commented Mar 20, 2014

Youtube url generate different pattern for different URL. In another word it verifies the ip. So the URL generated at computer A won't work on computer B.

@simplyi
Copy link
Author

@simplyi simplyi commented Mar 20, 2014

@xanadu Thank you for your reply! This is interesting and challenging.. I need these urls to play on mobile phone. I run youtube-dl on server and wanted to pass back urls to mobile phone so I can play them there. Is there a way you know Mobile Developers can use youtube-dl with their Apps? How to pass generated URLs back to the app?

@simplyi
Copy link
Author

@simplyi simplyi commented Mar 20, 2014

@xanadu if generated urls cannot be played on a device with a different IP, do you know why VEVO videos do not play even when signature is deciphered using the html5player javascript functions? there must be different functions youtube-dl is using? Do you know which?

function cE(a){a=a.split("");a=dE(a,48);a=a.slice(2);a=a.reverse();a=a.slice(1);a=dE(a,4);a=dE(a,35);return a.join("")}
function dE(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c;return a}

So I can decipher signature and make the url play on my mobile device?

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.