The Artima Developer Community
Sponsored Link

Agile Buzz Forum
More scripting fun

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
More scripting fun Posted: Dec 3, 2004 10:38 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: More scripting fun
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

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.

Read: More scripting fun

Topic: Print Media declining Previous Topic   Next Topic Topic: More Consistency, or just more?

Sponsored Links



Google
  Web Artima.com   

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