Return to Snippet

Revision: 62645
at March 4, 2013 23:41 by alces


Initial Code
RSS_URL = 'http://35photo.ru/rss/photo_day.xml'
OUT_NAM = "/var/tmp/${new Date().format('YYYYMMddHHmmss')}"

new XmlParser().parse(RSS_URL).channel.item.description*.text()*.findAll(/(?i)<img\s[^>]+>/) {im ->
	im.findAll(/(?i)src=['"]([^'"]+\.([^.'"]+))['"]/) {ma, sr, ex ->
		new FileOutputStream(OUT_NAM + "${sr.hashCode()}.$ex").write(new URL(sr).getBytes())
	}
}

Initial URL
rss_sav_img

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

Initial Title
Save all images from RSS feed

Initial Tags
regexp

Initial Language
Groovy