Send to Printer

BottomFeeder

More scripting fun

December 3, 2004 8:18:28.281

The script tool has made it easier for me to follow a bunch of comics that I like - I can easily scrape any of the feeds on the comics.com site into a local RSS file that I can subscribe to. Here's the script I use:


contentBlock := [:builder :chunk |
	| lnk |
	lnk := 'http://www.comics.com', chunk.
	builder link: lnk.
	builder title: 'Monty: ', Date today printString.
	builder description: '<img src="', lnk, '">'.
	builder pubDate: Timestamp now].

out := 'monty.xml' asFilename writeStream.
writer := RSS20_SAXWriter new output: out.
writer prolog.
writer startRSS.
writer startChannel.
writer title: 'For Better, For Worse'.
writer link: 'http://www.comics.com/comics/monty/index.html'.
writer description: 'Monty'.
writer pubDate: Timestamp now.
writer startItem.
writer title: 'Monty: ', Date today printString.
content := 'http://www.comics.com/comics/monty/index.html' asURI valueStream contents.
str := content readStream.
str throughAll: '<IMG SRC="/comics/monty'.
str upToAll: '<IMG SRC="/comics/monty'.
str throughAll: 'IMG SRC="'.
rest := str upToAll: '"'.
contentBlock value: writer value: rest.
writer endItem.
writer endChannel.
writer endRSS.
out close.

That script works for any of the comics on that site; all you have to do is change the titles and urls. I'm now subscribing to a bunch of the things there.

 Share Tweet This