Created
February 19, 2013 14:58
-
-
Save kevit/4986610 to your computer and use it in GitHub Desktop.
Safari Reading list to Pocket import script
This file contains hidden or 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
#!/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
Hello! Does Pocket automatically import articles from the html file in the tmp folder created by this script?