Downloading youtube on non-youtube capable phones

December 3rd, 2007 Comments Off

So, as many of you will know most phone’s browsers are incapable of properly displaying and playing youtube. There are several work arounds; one of my favorites being bywifi.com‘s solution. Their solution is to have a website where cell users can search and browse youtube in a mobile-capable fashion (so they parse youtube) then let you select a video to download. Their site fetches the video, converts it and provides it for you to download.

I’ve been using this service for some time. Yesterday however, their site was down. Me being impatient decided that wasn’t good enough for me; I want a service thats always around when I want it.

So I wrote it myself. Here is the result of about 2 hours of work. It needs a bit more polish, but it always works… in making the video. For some reason my phone is really picky about which 3gp files it will play. They’re all encoded the same, yet when I try and download in the browser it _always_ open with a text viewer, and when I do manage to actually save the file its only about 50% of the time that it is a “recognized format” (despite always having the same extention and same encodings).

I’ll be making small updates to that site, and posting the source here in the near future. But for those of you curious it uses the following tools:

Perl Module LWP::Simple to download youtube.com
Perl Regular expressions to parse youtube.com HTML (Google made it REALLY easy to parse <3 )
youtube-dl.py – A really cool python script which download’s FLVs from youtube.
Mplayer — to dump PCM audio from the FLV
Mencoder (from player) to dump a MPEG4 video stream from the FLV
FFMPEG to rencode the PCM and MPEG4 into a 3gp container