2010-09-30

Snagging Youtube Videos With RSS

For awhile now, I've been using the very excellent youtube-dl.py script to do a batch download of Youtube videos, every couple of weeks. (Must keep up with spill.com and TheOnion releases, after all.)

It became somewhat tedious, clicking through my subscriptions to cut and paste the new videos into a text file to get; especially when copying the URL directly on the subscriptions page yielded an unwieldy mess of URL garbage in addition to the video hash, requiring one to actually click through and copy from the URL on the video page.

Following a friend's suggestion to try using Youtube's RSS feed, I've found it really is much easier to simply use TheYoke to pull it.

I'm somehwat a n00b when it comes to RSS, but now my set up is to simply have my subscriptions piped into my toget.txt file, and then just delete the vids I don't want. It's terribly slow checking through video channels (I'm subscribed to a good many), so I'm using the subscription url:
http://gdata.youtube.com/feeds/base/users/[MY_USERNAME]/newsubscriptionvideos

The only downside is it just shows my account name "subscription" videos, versus having each channel as a feed, which shows the name. So, to know whether "Gay School Teacher Spanks Glenn Beck With A Swastika" is from PJTV, TheYoungTurks, or TheOnion, one still has to glance at the subscription page, but it's still quite a bit faster than manually cutting and pasting everything.

For people who know they're going to want everything on their subscribed channels, this all can obviously be very easily automated, with a single script and cronjob.

However, I prefer a little manual intervention, because I don't always want all the vids from channels I'm subscribed too (Chef Todd Mohr being a good example: His videos can be hit and miss. Also, USNW's... calculus is simply too beyond me. ;_) ) and my ISP tends to be rather bully-some when it comes to bandwidth usage during day 'prime time' hours.

My method is to add the subscription url (above) to ~/.theyoke/feed file, and then:

~$ theyoke --link --no-feedname >> toget.txt
~$ vi toget.txt
[ dd for each title line for video I want, 2dd for each title+url I don't ]
~$ tubesnake.sh

The last is simply a script file with:
youtube-dl -i -w -c -o %\(uploader\)s-%\(stitle\)s[%\(id\)s].%\(ext\)s -a toget.txt

Reference:

Youtube-dl.py: - For snagging a youtube url.
TheYoke - For snagging an RSS feed from the commandline.
Ubuntu Forum Thread - For setting up TheYoke and youtube-dl.py in a script.
Support Thread For Subscriptions - Using the subscription RSS feed didn't initially work for me; simple fix. (ik80's post)
Youtube's RSS Page - Various valid RSS feeds, doesn't list 'newsubscriptionvideos' though.