I wrote a thing: It lets you add and remove videos from your Youtube playlists and favorites from the command line or cron, without being logged in.

Lemme know if you find it useful.

I wrote this because none of the CPAN modules that purport to talk to Youtube seem to function offline (they all expect to be being run from a web server back-end with access to login cookies or something), which incidentally is the same reason that all of the Facebook tools in CPAN are useless.

Also, the existing tools seem to all talk the Youtube v2 protocol, which they deprecated a while ago, so it's presumably not long for this world. The v2 protocol was, of course, much easier to use than the v3 protocol. That will not stand: it had to be killed.

OAuth is really terrible, you know. Unrelentingly terrible. Also, water is wet.

The contortions required to use the Youtube API are very similar to -- yet different from in absolutely every particular -- to the contortions required to use the Facebook API, or the Twitter API. It's like OAuth is more of a "stylistic flourish" than an actual API. Saying that two services both use OAuth seems to be about as meaningful as saying that two cars are red. They're basically the same car, right?

I had to go through this OAuth crap (including the --generate-session nonsense) with my hack, and though many of the function names are the same, they really can't share any code. It's insane.

Previously, previously, previously.

Tags: , , , ,

10 Responses:

  1. Ben Bennett says:

    Thanks for the thing. That's a nice tool.

    Of tangentially related note, and are currently winning at the cat-and-mouse game with google for being able to download videos from the command line.

  2. Otto says:

    I feel your pain wrt OAuth. Truly. Solidarity, brother.

  3. Angela says:

    Very nice tool, but I can't use youtubedown to download videos from

  4. nooj says:

    YouTube v2.0 API is supposedly good until March 5, 2015:

    Google deprecation policy:

    Google will use commercially reasonable efforts to continue to operate [the v2 API] until the later of: (i) one year after the announcement or (ii) April 20, 2015....

    Deprecation announcement:

    Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014.

    I don't know what Google will decide is "commercially reasonable" once v3 is good enough, but since they still haven't finished implementing all of v3 yet, I guess they will keep v2 going for a while still. (At least I hope so, or all my youtube scripts will break for a few years, until someone creates a black box that makes OAuth painless. That might be a while.)

    Deprecation FAQ:

    Q: The Data API v2 supported anonymous API access for read-only queries, like video searches. Why do I need to register to make read-only calls in v3?

    A: Because fuck you.

  5. Anyone fancy throwing it up on CPAN?

  6. jwz says:

    A couple of interesting things I've discovered here:

    1: The v2 API wouldn't let you add more than 200 videos to a playlist. The v3 API seems to be unlimited (or, at least, the limit is over 3000).

    2: With the v2 API, it was really easy to hit the quota limit, and have to wait a few minutes before connecting again. I was trying to test that failure mode with this code and wasn't able to, because I haven't been able to hit the limit at all, and I've been adding videos to this test playlist for hours.

  7. Derp, Dr. Herp says:

    > It's insane.

    Welcome to social media.