Send to Printer

BottomFeeder

Another useful script

January 9, 2005 11:11:44.268

For all you gaming geeks out there, the script below scrapes Dork Tower into a local RSS feed:


| writer content str rest out |
contentBlock := [:builder :chunk |
	| stream base link |
	base := 'http://archive.gamespy.com/comics/dorktower/'.
	stream := ReadStream on: chunk.
	link := stream upTo: $".
	builder link: base, link.
	builder title: 'Dork Tower For: ', Core.Date today printString.
	builder description: '<img src="', (base, link), '">'.
	builder pubDate: Core.Timestamp now].

out := 'dorkTower.xml' asFilename writeStream.
[writer := RSS20_SAXWriter new output: out.
writer prolog.
writer startRSS.
writer startChannel.
writer title: 'Dork Tower Feed'.
writer link: 'http://archive.gamespy.com/comics/dorktower/'.
writer description: 'Dork Tower Feed'.
writer pubDate: Core.Timestamp now.
writer startItem.
writer title: 'Dork Tower For: ', Core.Date today printString.
content := 'http://archive.gamespy.com/comics/dorktower/' asURI valueStream contents.
str := content readStream.
str upToAll: 'images/comics'.
rest := str throughAll: '>'.
contentBlock value: writer value: rest.
writer endItem.
writer endChannel.
writer endRSS]
	ensure: [out close].

 Share Tweet This