YouTube Downloader and Feed Parser

So I decided to spend a bit of time over the holidays scratching an itch and writing some PHP code. The result is a new open source project: YouTube Downloader.

Its main purpose, for me, was to enable me to subscribe to a user’s YouTube videos as a podcast, and have the episodes downloaded in Downcast on my iPad. In the process though I also found it useful to make it usable as a form-based script, where you input a video’s ID and get a list of the available formats for download. So, the project does both.

Here’s the form (thanks to Twitter Bootstrap for the look & feel):


Once you’ve put a video id in the appropriate field and submitted, you’ll get a result that looks something like this:


You can right-click and choose “Save link as” (or whatever your browser calls it) to save any of the files. Unfortunately you have to set the filename and extension yourself.

To use it on a feed, take a look at feed_parser.php provided in the download. You can set a few variables at the top – including what feed it is you want to process – and then it will output an XML file which can be consumed in a podcatcher / podcast client.

Once you’ve got it working (outputting correctly to screen), set it to write out to a file in cron – for example:

/usr/bin/php /var/www/html/feed_parser.php > /var/www/html/feed.xml

If you want to manage multiple different feeds just duplicate feed_parser.php and rename it, and make sure to save the output to different filenames. There’s nothing specific about the name feed_parser.php or the output to feed.xml, so you can have many different ones running.

Feel free to use it, fork it on Github, and send me some pull requests!


  1. Not sure why folks are having trouble with it – it continues to work for me.

    I use it in a configuration where it is part of following a youtube user’s feeds and downloading their videos, and use it several times a week successfully.

  2. James – it does work. I use it several times a week.

    Likely configuration issue or difference in how your server is configured versus mine.

    Do you have access to the php error logs on your machine? Can you share any more info about what isn’t working and how you’ve set it up?

  3. Mark – after you installed php5-curl, did it start working for you?

    I think based on the IPv4 address issue it won’t – see this issue at GitHub:

    Seems that in order for it to work, you have to either:

    A. Be running it locally (client and server on same machine)


    B. Be running IPv6 on the server AND have an IP address in the US (or maybe just have a client IP that is the same region as the server IP)

  4. pradeepv Is your server in a different region than your localhost?

    YouTube may be doing some filtering by region. The keepvideos version uses javascript to do the parsing locally, so I’m not sure why that one would fail.

Comments are closed.