TringaliLuca

Extract <img tags from webpage, download images - scraping

Mar 20th, 2017
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data