The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague.
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.
#!/bin/sh
test $# -eq 1 || {
echo "Usage: mytube.sh "
exit 1
}
url=$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
youtube=http://www.youtube.com
curl -L $youtube/get_video?$video_url -o out.flv
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
Education Sponsors
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
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.
#!/bin/sh test $# -eq 1 || { echo "Usage: mytube.sh " exit 1 } url=$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 youtube=http://www.youtube.com curl -L $youtube/get_video?$video_url -o out.flvReply To This Comment