Results 1 to 8 of 8
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 ...
  1. #1
    Senior Professional Array

    Join Date
    Sep 2007
    Posts
    130
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    13

    Cool 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!



  2. #2
    Senior Professional Array

    Join Date
    Sep 2007
    Posts
    130
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    13

    Default 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

  3. #3
    Senior Professional Array

    Join Date
    Sep 2007
    Posts
    130
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    13

    Default 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'

  4. #4
    Amazingly Knowledgeable Array

    Join Date
    Oct 2007
    Posts
    803
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    47

    Default

    now we need a GUI.

  5. #5
    Senior Professional Array

    Join Date
    Sep 2007
    Posts
    130
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    13

    Default 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 11:31 AM. Reason: ++ info


  6. #6
    Professional Array riddle's Avatar

    Join Date
    Nov 2007
    Posts
    52
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    9

    Default

    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.

  7. #7
    Senior Professional Array

    Join Date
    Sep 2007
    Posts
    130
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    13

    Default

    It's ok either way The cache seems to start with header (which I read just to get link*) and is always appending. This means that once white progress tracker started running, anything else doesn't matter - you can play, you can rewind, you can go to other videos, you can close youtube, it's still there

    * I could read the database file that contains same information, but I prefer to enumerate cache files, since then I delete on success and this prevents same file from downloading several times.

  8. #8
    Respected Professional Array

    Join Date
    Oct 2007
    Posts
    514
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    34

    Default

    you might also want to consider adding a script that would allow you to delete the downloaded files.

 

 

Similar Threads

  1. Preview and Grab not working in iAtkos s3 v2 10.6.3
    By tushar199 in forum Using Snow Leopard
    Replies: 1
    Last Post: 11-21-2010, 02:24 PM
  2. Grab and get Signed your ECID for iPhone 3GS OS 3.1
    By LetsGoCellular in forum iPhone 3GS
    Replies: 1
    Last Post: 09-14-2009, 05:43 PM
  3. url / history / grab?
    By Pretendo in forum Genuine Mac Support
    Replies: 0
    Last Post: 04-04-2008, 12:10 PM
  4. [NEXT SIM II 3GPP] 5 for SALE, GRAB A DEAL!
    By iGun 4 Fun in forum Flea Market
    Replies: 8
    Last Post: 03-08-2008, 10:48 AM
  5. App Request: Youtube Grab
    By raza in forum Free Toolchain Software (Cydia App's)
    Replies: 7
    Last Post: 11-11-2007, 05:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 09:46 AM.
twitter, follow us!