damog / feedbag
- Source
- Commits
- Network (4)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
f787d8a
commit f787d8a6046a4161e73d9eec79bdc3b98ad694b0
tree 532f113b75771046a4a4db8aac5c4c340ec6c33e
parent 1afec49700320e1de916ea6dfc27765ef25cdc0a
tree 532f113b75771046a4a4db8aac5c4c340ec6c33e
parent 1afec49700320e1de916ea6dfc27765ef25cdc0a
feedbag / README.markdown
| 9dacecf7 » | damog | 2008-12-30 | 1 | Feedbag | |
| 2 | ======= | ||||
| 3 | > Do you want me to drag my sack across your face? | ||||
| 4 | > - Glenn Quagmire | ||||
| 5 | |||||
| 6b5563a2 » | damog | 2008-12-30 | 6 | Feedbag is a feed auto-discovery Ruby library. You don't need to know more about it. It is said to be: | |
| 7 | |||||
| 8 | > Ruby's favorite auto-discovery tool/library! | ||||
| 9dacecf7 » | damog | 2008-12-30 | 9 | ||
| 10 | ### Quick synopsis | ||||
| 11 | |||||
| 12 | >> require "rubygems" | ||||
| 13 | => true | ||||
| 14 | >> require "feedbag" | ||||
| 15 | => true | ||||
| 16 | >> Feedbag.find "log.damog.net" | ||||
| 17 | => ["http://feeds.feedburner.com/TeoremaDelCerdoInfinito", "http://log.damog.net/comments/feed/"] | ||||
| 29958053 » | damog | 2009-01-12 | 18 | >> Feedbag.feed?("google.com") | |
| 19 | => false | ||||
| 20 | >> Feedbag.feed?("http://planet.debian.org/rss20.xml") | ||||
| 21 | => true | ||||
| 9dacecf7 » | damog | 2008-12-30 | 22 | ||
| 23 | ### Installation | ||||
| 24 | |||||
| 25 | $ sudo gem install damog-feedbag -s http://gems.github.com/ | ||||
| 26 | |||||
| 6b5563a2 » | damog | 2008-12-30 | 27 | Or just grab feedbag.rb and use it on your own project: | |
| 28 | |||||
| 29 | $ wget http://github.com/damog/feedbag/raw/master/lib/feedbag.rb | ||||
| 30 | |||||
| 9dacecf7 » | damog | 2008-12-30 | 31 | ## Tutorial | |
| 32 | |||||
| 33 | So you want to know more about it. | ||||
| 34 | |||||
| 35 | OK, if the URL passed to the find method is a feed itself, that only feed URL will be returned. | ||||
| 36 | |||||
| 37 | >> Feedbag.find "github.com/damog.atom" | ||||
| 38 | => ["http://github.com/damog.atom"] | ||||
| 39 | >> | ||||
| 40 | |||||
| 41 | Otherwise, it will always return LINK feeds first, A (anchor tags) feeds later. Between A feeds, the ones hosted on the same URL's host, will have larger priority: | ||||
| 42 | |||||
| 43 | >> Feedbag.find "http://ve.planetalinux.org" | ||||
| 44 | => ["http://feedproxy.google.com/PlanetaLinuxVenezuela", "http://rendergraf.wordpress.com/feed/", "http://rootweiller.wordpress.com/feed/", "http://skatox.com/blog/feed/", "http://kodegeek.com/atom.xml", "http://blog.0x29.com.ve/?feed=rss2&cat=8"] | ||||
| 45 | >> | ||||
| 46 | |||||
| 47 | On your application you should only take the very first element of the array, most of the times: | ||||
| 48 | |||||
| 49 | >> Feedbag.find("planet.debian.org").first(3) | ||||
| 50 | => ["http://planet.debian.org/rss10.xml", "http://planet.debian.org/rss20.xml", "http://planet.debian.org/atom.xml"] | ||||
| 51 | >> | ||||
| 52 | |||||
| 53 | (Try running that same example without the "first" method. That example's host is a blog aggregator, so it has hundreds of feed URLs:) | ||||
| 54 | |||||
| 55 | >> Feedbag.find("planet.debian.org").size | ||||
| 56 | => 104 | ||||
| 57 | >> | ||||
| 58 | |||||
| 59 | Feedbag will find them all, but it will return the most important ones on the first elements on the array returned. | ||||
| 60 | |||||
| 61 | >> Feedbag.find("cnn.com") | ||||
| 62 | => ["http://rss.cnn.com/rss/cnn_topstories.rss", "http://rss.cnn.com/rss/cnn_latest.rss", "http://rss.cnn.com/services/podcasting/robinmeade/rss.xml"] | ||||
| 63 | >> | ||||
| 64 | |||||
| 65 | ### Why should you use it? | ||||
| 66 | |||||
| 67 | - Because it's cool. | ||||
| 95218c9c » | damog | 2008-12-30 | 68 | - Because it only uses [Hpricot](https://code.whytheluckystiff.net/hpricot/) as dependency. | |
| 9dacecf7 » | damog | 2008-12-30 | 69 | - Because it follows modern feed filename conventions (like those ones used by WordPress blogs, or Blogger, etc). | |
| 70 | - Because it's a single file you can embed easily in your application. | ||||
| 95218c9c » | damog | 2008-12-30 | 71 | - Because it passes most of the Mark Pilgrim's [Atom auto-discovery test suite](http://diveintomark.org/tests/client/autodiscovery/). It doesn't pass them all because some of those tests are broken (citation needed). | |
| 9dacecf7 » | damog | 2008-12-30 | 72 | ||
| 95218c9c » | damog | 2008-12-30 | 73 | ### Why did I build it? | |
| 9dacecf7 » | damog | 2008-12-30 | 74 | ||
| 03309fd7 » | damog | 2008-12-30 | 75 | - Because I liked Benjamin Trott's [Feed::Find](http://search.cpan.org/~btrott/Feed-Find-0.06/lib/Feed/Find.pm). | |
| 76 | - Because I thought it would be good to have Feed::Find's functionality in Ruby. | ||||
| 9dacecf7 » | damog | 2008-12-30 | 77 | - Because I thought it was going to be easy to maintain. | |
| 03309fd7 » | damog | 2008-12-30 | 78 | - Because I was going to use it on [rFeed](http://github.com/damog/rfeed). | |
| 95218c9c » | damog | 2008-12-30 | 79 | - And finally, because I didn't know [rfeedfinder](http://rfeedfinder.rubyforge.org/) existed :-) | |
| 9dacecf7 » | damog | 2008-12-30 | 80 | ||
| 03309fd7 » | damog | 2008-12-30 | 81 | ### Bugs | |
| 82 | |||||
| 83 | Please, report bugs to [rt@support.axiombox.com](rt@support.axiombox.com) or directly to the author. | ||||
| 84 | |||||
| 6b5563a2 » | damog | 2008-12-30 | 85 | ### Contribute | |
| 86 | |||||
| 87 | > git clone git://github.com/damog/feedbag.git | ||||
| 88 | |||||
| 89 | ...patch, build, hack and make pull requests. I'll be glad. | ||||
| 90 | |||||
| 91 | ### Author | ||||
| 92 | |||||
| 95218c9c » | damog | 2008-12-30 | 93 | [David Moreno](http://damog.net/) <[david@axiombox.com](mailto:david@axiombox.com)>. | |
| 6b5563a2 » | damog | 2008-12-30 | 94 | ||
| 95 | ### Copyright | ||||
| 96 | |||||
| 03309fd7 » | damog | 2008-12-30 | 97 | This is free software. See [COPYING](http://github.com/damog/feedbag/master/COPYING) for more information. | |
| 6b5563a2 » | damog | 2008-12-30 | 98 | ||
| 99 | ### Thanks | ||||
| 100 | |||||
| 03309fd7 » | damog | 2008-12-30 | 101 | [Raquel](http://maggit.net), for making [Axiombox](http://axiombox.com) and most of my dreams possible. Also, [GitHub](http://github.com) for making a nice code sharing service that doesn't suck. | |
| 6b5563a2 » | damog | 2008-12-30 | 102 | ||

