Last active
October 31, 2015 16:36
-
-
Save nhoag/a56c8ecddca2d2df571a to your computer and use it in GitHub Desktop.
Get Popular Items from Pinboard in your terminal
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
function pb-pop() { | |
echo -e "Pinboard: Trending" | |
curl -s https://pinboard.in/popular/ \ | |
| xmllint --html --xpath '//*[contains(@class,"bookmark_title")]' - 2>/dev/null \ | |
| xmllint --html --xpath '//a/@href|//a/text()' - 2>/dev/null \ | |
| sed 's#href=#\'$'\n#g' \ | |
| grep http \ | |
| sed 's#^"##;s#"#\'$'\n\t#' \ | |
| awk '{ gsub(/^http.*/, "\n\033[0;32m&\033[0m\n"); print }' | |
echo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment