Last active
January 3, 2016 01:49
-
-
Save coderofsalvation/8391480 to your computer and use it in GitHub Desktop.
tries to extract links from htmlcontent (hint: use with htmldompath)
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
| # tries to extract links from htmlcontent (hint: use with htmldompath) | |
| # @param htmlinput (piped) | |
| # usage: curl "http://foo.com" | htmlgreplinks | sort | uniq | |
| htmlgreplinks(){ | |
| cat - | grep -E "(href|src|action)=[\"']*[\"']" | \ | |
| sed "s/.*href=['\"]//g" | \ | |
| sed "s/.*action=['\"]//g" | \ | |
| sed "s/.*src=['\"]//g" | \ | |
| sed "s/['\"].*//g" | while read line; do [[ ! "$line" == "#" ]] && echo "$line"; done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment