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

Generating YouTube download URLs on a web server #13474

Closed
davidturnbull opened this issue Jun 23, 2017 · 2 comments
Closed

Generating YouTube download URLs on a web server #13474

davidturnbull opened this issue Jun 23, 2017 · 2 comments

Comments

@davidturnbull
Copy link

@davidturnbull davidturnbull commented Jun 23, 2017

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.06.23. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.06.23

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Hi,

I'm building a simple web app so I'm able to download YouTube videos via an RSS feed, and I'm hoping to achieve this by using youtube-dl on a web server to generate download URLs and then save them in a database. Then, ideally, I can download the videos via the RSS feed, directly from YouTube's servers, without first downloading them to the web server.

This seemed to be working well enough, but it seems like some download URLs just don't work, and I'm not sure what makes them different from the URLs that do work.

For example, when the server grabs the download location of this video: https://www.youtube.com/watch?v=PHWqKcqfn9c ... it produces the following URL:

https://r9---sn-p5qlsn7l.googlevideo.com/videoplayback?ratebypass=yes&ei=u5tMWdyUIaTV8gSXtp2gCw&mt=1498192725&mv=m&ms=au&source=youtube&mm=31&pl=14&mn=sn-p5qlsn7l&id=o-AF4jXa0vsUGEKJBCX2DfcF7JU1wmmbZgzZOn9tqKpE5j&dur=866.034&requiressl=yes&ipbits=0&expire=1498214427&gcr=us&sparams=clen%2Cdur%2Cei%2Cgcr%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&initcwndbps=10517500&lmt=1497619931021468&mime=video%2Fmp4&key=yt6&itag=18&ip=54.161.139.249&clen=75792873&gir=yes&signature=D6EE9304D4ACEDA69AADE8A43A7A3A37AA05DE70.952B0C146CAD348C6A94903957A715590760CDE1

But when I visit this URL, I receive a "403 Forbidden" error.

When the server grabs the download location of this video though: https://www.youtube.com/watch?v=FfGKNJ4mldE ... it produces the following URL:

https://r11---sn-p5qlsnsz.googlevideo.com/videoplayback?ms=au&ei=05tMWafUKcnt8wSOqZLQCQ&mv=m&pl=14&ipbits=0&source=youtube&id=o-ALihJ05DFtjlbxmdb9ZKmowLkBbUCX3B1RmrQYcJfxJg&expire=1498214451&mm=31&itag=18&mt=1498192725&mn=sn-p5qlsnsz&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&signature=06EB46796F04A5B55529B1EBDD2C5F75AF492D92.E2EC6ACEB4391167A9E4B2869A3FF5276E1D4141&requiressl=yes&initcwndbps=10510000&ip=54.161.139.249&key=yt6&gir=yes&mime=video%2Fmp4&clen=15660488&ratebypass=yes&dur=318.995&lmt=1446542239169564

And it works perfectly fine.

On the server, this is the specific command that's being run every time:

youtube-dl VIDEO_URL --format '(mp4)[height<=480]' --get-url

It's worth noting that all of the URLs work when they're generated on my local machine.

If all of the URLs were broken, I'd assume that it's just not possible to do what I want to do, but the fact that most of them work gives me hope that it's a solvable problem.

Any help would be appreciated.

:)

@davidturnbull
Copy link
Author

@davidturnbull davidturnbull commented Jun 23, 2017

Also worth mentioning that I've read the "I extracted a video URL with -g, but it does not play on another machine / in my web browser" section of the README, and it seems like the answer to my question is in that section. I'm just hoping I can get a little more guidance. (Will keep hacking away though.)

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 23, 2017

#9001 (comment) may help.

@dstftw dstftw closed this Jun 23, 2017
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
2 participants
You can’t perform that action at this time.