You're viewing a comment by bsergean and its responses.

bsergean Permalink
October 24, 2008, 07:38

Cool post !

I digged inside your (nice) code, and came out with another version using curl. The output name is always out.flv thought ...

What was interesting is to look at the server header with curl -i.
First web page hit is apache, and the videos are served with lighttd, as they say in the google video explaining youtube guts.


test $# -eq 1 || {
        echo "Usage: "
        exit 1

# Get video ID.
video_url=`curl -s $url | awk '{ if (match($0, /"video_id": "([^"]+)".+"t": "([^"]+)"/, matches)) { print "video_id=" matches[1] "&t=" matches[2] } }'`

# Download video to output.flv
curl -L $youtube/get_video?$video_url -o out.flv

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "coding_3": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.