2

I'm currently writing a Java application which will download any video and convert it to MP3 (I know there's a ton of similar stuff out there, this is just a bit of a learning experience.)

I'm currently at the point where it retrieves the list of formats and URLs, and it downloads the videos in MP4 format just fine (the only thing it does to achieve that is directly download the URL given in the stream format map.)

However, youtube gives me a 403 forbidden error whenever I try to download an FLV video (which is quite a large issue since a lot of videos are only available in FLV format.) After some quick inspection using chrome developer tools it turns out there's a cookie called ACTIVITY which is being sent to the server when starting the actual video download, and the value is very similar to a timestamp received from the original call to /watch, only 3 digits more accurate (so that would be milliseconds). I'm not sure if this is the problem; could be generate_204, a request that also caught my attention in the chrome developer tools.

Please don't point me to complicated unreadable Python/etc. examples. I strongly dislike Python and I'm not at the level where I'm able to fluently read someone else's code (especially if it's large and complicated ;) yet. Thanks.

tl;dr - What else is there to get youtube to send me my FLV instead of throwing a 403 forbidden? Does it have to do with cookies? generate_204? etc..

CookieMonster
  • 1,177
  • 4
  • 14
  • 30
  • 1
    Section 4c You agree not to access Content through any technology or means other than the video playback pages of the Service itself, the Embeddable Player, or other explicitly authorized means YouTube may designate. – Keibosh Jan 30 '12 at 19:46
  • 4
    OK I get it, this is illegal. As I said, it was just going to be a learning experience. It's not like there's not a shitload of tools to download and convert YouTube videos out there already. – CookieMonster Feb 02 '12 at 20:34
  • StackOverflow is still not the place for it. – Louis Wasserman Feb 02 '12 at 20:47

2 Answers2

3

You should add “signature” parameter to your videoplayback url. Signature is contained in fmt url as sig parameter. Just look for sig attribute in page source and for signature in final url using Fiddler for example.

Nazar Grynko
  • 561
  • 1
  • 5
  • 26
1

This is against YouTube's Terms of Service, I believe, section 5B...and I suspect it's illegal.

Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413