Discuss Youtube Grab: grab.sh at the General - Hackint0sh.org; I've finally written a script that saves YouTube videos you are viewing. It's a bash ...
-
Senior Professional
Array
Youtube Grab: grab.sh
I've finally written a script that saves YouTube videos you are viewing. It's a bash script attached (grab, you can save it as grab.sh) + index file maker (indx), which at the moment blatantly uses digg.com/css/iphone.css stylesheet and should only be used as a preview of what could be in the future.
Requirements - Erica's utils (wget), lighttpd as server. The code is down in comments since I can't upload them neither as .sh nor as .txt:
As you might guess, this is my first bash script. It's quite self-explanatory. You use it like this:
to install:
# create directory ~/Sites/music
# download scripts to iphone (i assume it's somewhere like ~/grab.sh)
to grab:
# open the file you want in youtube (don't have to wait to download)
# repeat for other files you want in youtube
# run bash ~/grab.sh or bash ~/grab.sh "Song Name"
# it will automatically find cached links to recenly viewed movies from youtube, download them and erase cache
# the files go to ~/Sites/music as "Song Name[Length].m4v", so you'll be able to tell songs from each other even if you leave song name blank
# run bash ~/indx.sh
to enjoy:
# point your browser to 127.0.0.1/music
# click on video to view it!
-
-
Senior Professional
Array
grab.sh
#requires: Erica's utils (wget)
cd /var/root/Sites/music/
agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A109a Safari/419.3"
for file in /var/tmp/MediaCache/Cache*; do if [ -f $file ]; then
place=$(head $file --bytes=10000|grep '<string>http://vp.*</string>' -a | sed -e 's/amp;//g;s/<.string>//g;s/<string>//g;s/^%09*//g')
if [ -n "$place" ]; then
len=$(echo "$place" | sed -e 's/^.*len=//g;s/000&.*$//g')
~/bin/wget -U="$agent" -O"$1[$len].m4v" $place
rm $file > /dev/null
else echo 'A file not from videoplayer'; fi
else echo 'No files found in media cache'; fi; done
-
-
Senior Professional
Array
indx.sh
#requires: lighttpd
cd /var/root/Sites/music
echo "<html><head><title> My iPhone library</title>" > index.html
echo "<meta name='viewport' content='width=320; initial-scale=1.0; maximum-scale=1.0; userscalable=0;'/>" >>index.html
echo "<style type='text/css' media='screen'>@import 'http://www.digg.com/css/iphone.css'; .button , .settings {color: blue;}</style>" >> index.html
echo "</head><body><h2>My Library</h2><a class='showPage button' href='grab.sh'>Grab</a><a class='showPage settings' href='reindex.py'>Reindex</a><ul id='stories' title='Digg' selected='true'>" >> index.html
for file in *.m4v *.mov *.mpeg; do if [ -f "$file" ]; then
if [ -n "$(echo "$file" | grep '\[[0-9]*\]')" ]; then
number=$(echo $(( ( $(echo "$file" | sed -e 's/.*\[//g;s/\].*//g')+29)/60)) 'm');
name=$(echo "$file" | sed -e 's/\ *[[0-9]* *\]//g' | sed -e 's/\.m..$//g'); if [ -z "$name" ]; then name="$file"; fi;
else number=''; name=$(echo "$file" | sed -e 's/\.m..$//g'); fi
echo "<li> <a class='showPage digg-count'>$number</a><a class='showPage link' href='$file' type='video/quicktime'>$name</a></li>" >> index.html
fi; done
echo "</ul></body></html>" >> index.html; echo 'index.html generated'
-
Amazingly Knowledgeable
Array
-
-
Senior Professional
Array
plans
# SLEEP, restoring iPhone after unrelated crash, preparing wiki
# python scripts for generating nice webpage = GUI
# demon to do it automatically to all videos you view on youtube
# preparing own css intead of stolen digg's
# filling of meta-information, such as album and thumbnail
updates - in native software
Last edited by squirrelfon; 11-26-2007 at 12:31 PM.
Reason: ++ info
-
Professional
Array
I have a question - what to do if my YouTube starts playing automatically? I think it can make header of YouTube garbled thus this script won't work. Or maybe I'm wrong?
8GB iPhone OTB 1.0.2, virginized and upgraded to 1.1.1. Updated to 1.1.2 + anySIM1.2.1u // Poland, Carrier: PlusGSM
Phone I/O. Check. YouTube. Check. Mail, Safari, Widgets. Check.
3rd Party Apps. Check. WiFi, EDGE, SSH. Check.
-
-
Senior Professional
Array
-
Respected Professional
Array
you might also want to consider adding a script that would allow you to delete the downloaded files.
-
Similar Threads
-
By tushar199 in forum Using Snow Leopard
Replies: 1
Last Post: 11-21-2010, 03:24 PM
-
By LetsGoCellular in forum iPhone 3GS
Replies: 1
Last Post: 09-14-2009, 05:43 PM
-
By Pretendo in forum Genuine Mac Support
Replies: 0
Last Post: 04-04-2008, 12:10 PM
-
By iGun 4 Fun in forum Flea Market
Replies: 8
Last Post: 03-08-2008, 11:48 AM
-
By raza in forum Free Toolchain Software
Replies: 7
Last Post: 11-11-2007, 06:27 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks