« Previous  |  Next »

Parsing RSS with Pharo Smalltalk

6 April 2014

Soup is a port of the Python Beautiful Soup HTML parser.

Load it:

Gofer new 
    smalltalkhubUser: 'PharoExtras' project: 'Soup';
    package: 'ConfigurationOfSoup';
    load.
(ConfigurationOfSoup project version: #stable) load.

Soup can be used to parse RSS.

| s |
s := Soup fromString: (ZnEasy get: 'http://samadhiweb.com/blog/rss.xml') contents.
((s findTag: 'channel') findAllChildTags: 'item') do: [ :ele |
    Transcript show: (ele findTag: 'title') text; cr ].
Transcript flush.

The above code produces the following output:

ROE with NBSQLite3
Enduring
Scaling Web Applications on PostgreSQL
NBSQLite3 - NativeBoost SQLite for Pharo
OSX NativeBoost FFI Oddity

Tested on Pharo versions 2.0 and 3.0 beta.

Blog comments powered by Disqus