xLite
xLite

Reputation: 1481

How do I get a YouTube FLV URL?

Looking through the site, every question uses an outdated method. How do the YouTube FLV downloader websites/applications do it?

I am trying to do this in PHP but the theory or steps to do it will suffice, thanks.

Upvotes: 3

Views: 17356

Answers (4)

rbrito
rbrito

Reputation: 2498

As mentioned in other posts, you may want to look at our code in youtube-dl (or in the code of the Firefox extension called FlashVideoReplacer).

In the particular case of youtube-dl, the "real work" is done in the subclasses of InformationExtractor and it hard to give a "stable" answer, as the layout of such sites changes constantly.

There are some pieces of the information that are not dynamic, such as, for instance, the uploader of the video, the title, the date of upload, and, most importantly, the identifier of the video (a 11-character string).

For the dynamic parts, what can be said about such tools is that, essentially, the URLs generated by such videos are dynamically generated and you need to perform some back-and-forth communication with the server.

It is important to have in mind that what such sites can (and do) take into consideration depend on a number of parameters, including: the cookies that you have already received---as the case for HTML5 videos, your geolocation---for regional control, your age--for "strong" material, your language/locale---for showing content tailored to you, etc.

youtube-dl uses a regular expression to extract the video ID from the URL that you give and, then, uses a "normalized", typical URL as used from the United States, from which to proceed.

Some of the dynamic data to be gathered includes:

  • some time-stamp (the expire, and fexp parts of the final URL)
  • the cookies sent to the browser
  • the format in which we want to download the video (the itag part of the final URL)
  • throttling information (the algorithm, burst, factor)
  • some hashes/tokens used internally by them (e.g., the signature part of the final URL)

Some of the information listed above were once not required, but now they are (in particular, the cookies that they send you). This means that the information listed above is very likely to become obsolete, as the controls become stricter.

You can see some of the work (with respect to the cookies) that I did in this regard in the implementation of an external backend to use an external downloader (a "download accelerator") with what youtube-dl extracts.

Discloser: I have committed some changes to the repository, and I maintain the youtube-dl package in Debian (and, as a side effect, in Ubuntu).

Upvotes: 16

Bhanu Bais
Bhanu Bais

Reputation: 1

If you really want to get an url of youtube video in flv or mp4 mode then use "YouTube Downloader - Version: 5.0" in Chrome you can right click on download button and copy path.

![You can get url of any format from this button][1]

https://i.sstatic.net/AFUWr.jpg (see this url due to i can't upload image at this time)

You can click on this button and copy url from "chrome://downloads/" I think this may help you.

Upvotes: -1

Jonathan Callen
Jonathan Callen

Reputation: 11591

You might want to take a look at how youtube-dl downloads the files. As YouTube changes, that program does seem to get updated rather quickly.

Upvotes: 4

Korvin Szanto
Korvin Szanto

Reputation: 4501

Youtube doesn't store FLV files, they compile your video into a SWF object. Those videos need to be either extracted or converted to FLV in order to get the FLV.

http://www.youtube.com/v/videoid

ex:

http://www.youtube.com/watch?v=C6nRb45I3e4

becomes

http://www.youtube.com/v/C6nRb45I3e4

From there, you need to convert the SWF into an flv, which can be done with ffmpeg.

Upvotes: 1

Related Questions