Created
September 20, 2012 04:01
-
-
Save audionerd/3753910 to your computer and use it in GitHub Desktop.
YouTube app favorites - how to extract them from your iOS backups if iOS 6 replaces the YouTube app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# visit your iOS backups folder | |
cd ~/Library/Application\ Support/MobileSync/Backup/ | |
# go to the most recent backup sub-folder | |
cd `ls -t1 | head -1` | |
# find the YouTube bookmarks file | |
grep -r "BookmarksMergeOffered" . | |
> ./fa2a1edd7d2789794b49856a1ad60f6ff002f1e0: <key>BookmarksMergeOffered</key> | |
# Copy that file to a new file named "youtube.bookmarks.plist.xml", and put it in a temporary folder. | |
cp fa2a1edd7d2789794b49856a1ad60f6ff002f1e0 ~/Desktop/tmp/youtube.bookmarks.plist.xml | |
cd ~/Desktop/tmp | |
# Grab all the ids (including recent history, which means some duplicates, sorry) | |
cat youtube.bookmarks.plist.xml | ruby -ne 'puts $1 if /<string>(.{11})<\/string>/' > youtube.bookmarks.ids.txt | |
# Use YouTube's oEmbed API to grab the data for each id | |
# (not 100% foolproof – I ran into 404's and 401's, but I had some old bookmarks...) | |
cat youtube.bookmarks.ids.txt | ruby -ne 'puts "http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D#{$_.chomp}&format=json"' > youtube.bookmarks.oembeds.txt | |
cat youtube.bookmarks.oembeds.txt | xargs curl -w "\n%{url_effective}\n\n" > youtube.bookmarks.json | |
# parse out the HTML for every single video and put it into one giant HTML file (warning, this could be really difficult for your browser to load!) | |
cat youtube.bookmarks.json | ruby -rjson -ne 'puts JSON.parse($_)["html"] rescue puts "<p>#{$_}</p>\n\n"' > index.html | |
# alternately, to get a bunch of thumbnails + oEmbed links: | |
cat youtube.bookmarks.json | ruby -rjson -ne 'puts "<img src=" + JSON.parse($_)["thumbnail_url"] + "><br>" rescue puts "<a href=#{$_}>#{$_}</a><br/>"' > index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment