Atom 1.0 parser for Ruby
I've been looking for a Ruby library for parsing Atom 1.0. The only one I could find was FeedTools. Unfortunately, it's intended to be a universal feed-parsing library and not quite what I need.
As a result, I decided to build my own. The project is hosted at RubyForge and the source code is available under the MIT license.
It is still in its early stages, so don't expect much at this point. So far, it understands most atom:* elements and attributes but doesn't perform validation.
The interface is fairly simple. For example, you can do this:
require 'atom'
require 'net/http'
require 'uri'
str = Net::HTTP::get(URI::parse('http://blog.ning.com/atom.xml'))
feed = Atom::Feed.new(str)
feed.entries.each { |entry|
puts "'#{entry.title}' by #{entry.authors.first.name} on #{entry.published.strftime('%m/%d/%Y')}"
}
Give it a try, play with it. Comments are welcome!
As a result, I decided to build my own. The project is hosted at RubyForge and the source code is available under the MIT license.
It is still in its early stages, so don't expect much at this point. So far, it understands most atom:* elements and attributes but doesn't perform validation.
The interface is fairly simple. For example, you can do this:
require 'atom'
require 'net/http'
require 'uri'
str = Net::HTTP::get(URI::parse('http://blog.ning.com/atom.xml'))
feed = Atom::Feed.new(str)
feed.entries.each { |entry|
puts "'#{entry.title}' by #{entry.authors.first.name} on #{entry.published.strftime('%m/%d/%Y')}"
}
Give it a try, play with it. Comments are welcome!
Labels: ruby
14 Comments:
How to get Link href value?
entry.links[0]
This is exactly what I was looking for! This, combined with the standard Ruby RSS parser, should give me everything I need to grab feeds I think. You rock!
is it possible to generate Google apps atom feed?
If yes then what kind changes i nned to do with this library or need to embed any other library with this.
This comment has been removed by the author.
Hi, is there a way to get at extension elements in the Atom feed? For example <openSearch:totalResults>
How do I get the value of src from the following?
entry....
.
.
.
content type="text/plain"
xml:lang="en"
src="http://...."
/content
/entry
I tried entry.content.src, entry.content['src']. But both didn't work
entry.content.src should work. Can you send me your complete test case so that I can debug it here?
Hi Martin,
I did 'inspect' on the feed returned by Atom. The value of src goes as the value of href of the third link in the entry. Not sure why that happens but am able to access src using entry.links[2].href
You know ,I have some priston tale Gold,and my friend also has some priston tale Money,do you kouw they have the same meaning,I just want to buy priston tale Gold,because there are many cheap priston tale GoldYou know ,I have some wonderland Gold,and my friend also has some wonderland online Gold,do you kouw they have the same meaning,Both of them can be called
wonderland money,I just want to
buy wonderland Gold,because there are many
cheap wonderland online Gold
I can get Pirates of the Burning Sea Gold cheaply,
Yesterday i want to buy potbs goldfor my brother.
i hope him like it. i will buy potbs Doubloon for him
as birthday present. i like the potbs money very much.
I usuallybuy potbs Doubloon and keep it in my store.
wow power levelingpower levelingwow power levelpowerlevelingpower levelwow powerlevelingwow goldbuy wow goldcheap wow gold
Pandeglang is one of many places in Indonesia are eligible for tourist destination.
Kenali dan Kunjungi Objek Wisata di Pandeglang Objek Wisata di Pandeglang Kenali dan Kunjungi Objek Wisata di Pandeglang Pantai Carita Seni Saman Rampak Bedug
Clothing has always been a thing that has been given a great importance by human beings. It displays the attitude that the people exhibit.
ed hardy clothes
ed hardy shirts
Lots of brands have been existent in the clothing industry and a famous one among them is the Ed hardy clothing brand.
ed hardy jackets
ed hardy hoodies
The brand got its name from the famous American tattoo artist Ed Hardy. He was a very famous tattoo artist and has published many books on tattooing techniques.
ed hardy boots
ed hardy polo shirts
But his tattooing turned into a brand by the efforts of a company called Christian Audiger. This company was a very famous and very powerful company in the field of clothing.
ed hardy shoes
ed hardy jeans
They felt that it would be appropriate to create a brand called Ed hardy and use Hardy's art as the main selling point for the brand. This venture had turned out to be a very successful one and Ed hardy clothing is one of the most famous brands in the clothing industry.
ed hardy outerwear
ed hardy long sleeve shirts
The brand became very famous because it was worn by many famous celebrities like Madonna, Britney spears and also Sylvester Stallone.
ed hardy bags
ed hardy uggr boots
The brand has clothes for men, women, and kids. They have also diversified their business by having a lot of accessories to support their clothing business.
ed hardy love kills slowly shirts
ed hardy love kills slowly shoes
ed hardy love kills slowly boots
for men they have a variety of products such as active wear, denim, outwear, swim trucks, sweaters, t-shirts, tops etc.
ed hardy trousers
ed hardy mens
the accessories include things such as belts, caps, scarves, shoes, socks, jeweler, sunglasses, ties and even wallets.
The art works is a unique combination of American and Japanese cultures. The unique selling proposition of the brand is the way in which the company has used the art works of Ed hardy.
ed hardy womens
ed hardy t shirts
ed hardy sunglasses
Post a Comment
<< Home