The Artima Developer Community
Sponsored Link

Python Buzz Forum
Write Your Own Mini Aggregator with Jython and Rome!

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
Ed Taekema

Posts: 52
Nickname: etaekema
Registered: Jul, 2004

Ed Taekema is a wandering Jython enthusiast
Write Your Own Mini Aggregator with Jython and Rome! Posted: Jul 1, 2004 4:28 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ed Taekema.
Original Post: Write Your Own Mini Aggregator with Jython and Rome!
Feed Title: All things Jythonic
Feed URL: http://www.pycs.net/users/0000177/categories/jython/rss.xml
Feed Description: Blogging Jython...
Latest Python Buzz Posts
Latest Python Buzz Posts by Ed Taekema
Latest Posts From All things Jythonic

Advertisement

Rome is a new java API for reading RSS and ATOM feeds. Here is a quick demonstration of what you can do with it using Jython, the Java Scripting Swiss Army Knife.

Ok, you will need to add both the latest build of Rome and JDOM to your classpath. Next fire up jython or if you like use the Jython Console which will make exploring the ROME api a little easier.

Here is the source code then of a simple aggregator written in jython.

from java.net import URL
from com.sun.syndication.feed.synd import SyndFeedI
from com.sun.syndication.io import SyndFeedInput

myUrl = URL('http://www.pycs.net/users/0000177/rss.xml')

input = SyndFeedInput()
feed = input.build(myUrl.openStream())

entries = feed.getEntries()

for post in entries:
    title = post.getTitle()
    link = post.getLink()

    print """<a href='%s'>%s</a>""" % (title, link)

When you run this, you will get a list of links pointing to the posts in the feed, in this case the feed for my main site.

Read: Write Your Own Mini Aggregator with Jython and Rome!

Topic: Password Managers (Open Source, Possibly Portable) Previous Topic   Next Topic Topic: Pedantic

Sponsored Links



Google
  Web Artima.com   

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