I recently uploaded my first distribution to CPAN, the Comprehensive Perl Archive Network. Named App-WatchLater, it consists of a couple of scripts that manage a queue of YouTube videos to be watched later. (I know, real First World Problem right there.)
Why on Earth would I write such a thing when there’s literally a Watch Later feature built into YouTube itself? Well, I guess it must be my weird consumption habits.
At one point I had over 2800 videos on my YouTube Watch Later playlist, which became super unwieldy. YouTube playlists only load 100 videos at a time, and my Watch Later list was in a totally arbitrary order and completely unsearchable.
The main modules are
App::WatchLater, which controls most of the database and
command-line options, and
App::WatchLater::YouTube, which is an interface to
the YouTube Data API.
watch-later maintains a SQLite database of videos, including the
video ID, title, and channel name and ID. It also keeps track of which have been
watched and which have not. (More fields may be added in the future, e.g., video
Then, using the SQLite command-line tool, it is easy to query for videos I’ve bookmarked from a given channel or with a given keyword in the title, so that I can watch something appropriate for the mood I’m in.
Since the YouTube Data API no longer allows access to the user’s
Later) playlist items, it was not possible for me to directly retrieve all of
the videos in my queue and then clear out my queue.
Now, just 2420 to go. If only I had the willpower to take care of the root cause…