The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Another useful script

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Another useful script Posted: Jan 10, 2005 1:12 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Another useful script
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

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].

Read: Another useful script

Topic: It's all about Dave! Previous Topic   Next Topic Topic: What makes a story?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use