Skip to content

Instantly share code, notes, and snippets.

@eiriklv
Forked from kevit/gist:4986610
Created April 17, 2014 01:00
Show Gist options
  • Save eiriklv/10946014 to your computer and use it in GitHub Desktop.
Save eiriklv/10946014 to your computer and use it in GitHub Desktop.
#!/bin/sh
#http://getpocket.com/import/instapaper
set -x
cat >> /tmp/import.html << "EOF"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Instapaper: Export</title>
</head>
<body>
<h1>Unread</h1>
<ol>
<li><a href="
EOF
for i in `/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'`; do
echo $i >> /tmp/import.html
echo "\">" >> /tmp/import.html
echo $i >> /tmp/import.html
# curl -L $i |grep "<title>" |sed -e :a -e 's/<[^>]*>//g;/</N;//ba' >> /tmp/import.html
echo "</a></li><li><a href=\"" >> /tmp/import.html
done
cat >> /tmp/import.html << "EOF"
</a></li>
</ol>
<h1>Archive</h1>
<ol>
<li><a href="http://">http://</a></li>
</ol>
</body>
</html>
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment