Save all images from RSS feed


/ Published in: Groovy
Save to your folder(s)

Gets "src" attributes from all "img" tags in RSS entries descriptions


Copy this code and paste it in your HTML
  1. RSS_URL = 'http://35photo.ru/rss/photo_day.xml'
  2. OUT_NAM = "/var/tmp/${new Date().format('YYYYMMddHHmmss')}"
  3.  
  4. new XmlParser().parse(RSS_URL).channel.item.description*.text()*.findAll(/(?i)<img\s[^>]+>/) {im ->
  5. im.findAll(/(?i)src=['"]([^'"]+\.([^.'"]+))['"]/) {ma, sr, ex ->
  6. new FileOutputStream(OUT_NAM + "${sr.hashCode()}.$ex").write(new URL(sr).getBytes())
  7. }
  8. }

URL: rss_sav_img

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.