TringaliLuca

Extract <img tags from webpage, download images - scraping

Mar 20th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. url=$1
  2.  
  3. curl $url | grep -o '<img src=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^<img src=["'"'"']//' -e 's/["'"'"']$//' > extract-img-tmp.txt
  4.  
  5. #curl $url  | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//' > extract-img-tmp-links.txt
  6.  
  7. while read line
  8. do
  9. curl -O -L $line
  10. done <extract-img-tmp.txt
  11.  
  12. rm extract-img-tmp.txt
Add Comment
Please, Sign In to add comment