-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
74 lines (48 loc) · 2.26 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Feedsucker
==========
Rails plugin to load feeds (using FeedTools) or XML resources (using REXML::XPath expressions) into an ActiveRecord model (called FeedsuckerPost).
Feedsucker uses another AR model (called FeedsuckerFeed) to store the settings of the different sources it should suck from.
FeedsuckerPost model currently has the following fields: title, content, date, url, blog_title and blog_url (and the foreign key of the FeedsuckerFeed from which the data was sucked).
FeedsuckerFeed model has the following fields: title, url, number_of_posts, xpath_post_title, xpath_post_content, xpath_post_date, xpath_post_url, xpath_blog_title and xpath_blog_url.
Example
=======
To create a RSS/Atom feed to suck from:
FeedsuckerFeed.create(
:title => 'RSS/Atom example',
:nicetitle => 'atom-example',
:number_of_posts => 3, # optional (all posts in feed if blank),
:delete_preview => true, # optional: delete all posts from a feed, before it´s sucked (default -> true)
:url => 'http://example.com/posts.atom')
To create it but sucking from XML resouce index:
FeedsuckerFeed.create(
:title => 'XML resource index example',
:nicetitle => 'xml-example',
:url => 'http://example.com/temas/arte-y-arquitectura/xml',
:number_of_posts => 3, # optional (all posts if blank)
:xpath_post_title => '//post-title/text()',
:xpath_post_content => '//post-body/text()',
:xpath_post_date => '//post-date/text()',
:xpath_post_url => '//post-id/text()',
:xpath_blog_title => '//blog-title/text()',
:xpath_blog_url => '//blog-url/text()')
To suck a feed:
FeedsuckerFeed.find_by_title('atom-example').suck!
To suck them all:
FeedsuckerFeed.suck_all!
To show sucked items in a view:
<% FeedsuckerFeed.find_by_title('Calippo').posts.each do |post| %>
<h3><%= post.title %></h3>
[...]
<% end %>
Installation
============
With:
script/plugin install git://github.com/thecocktail/feedsucker.git
Or:
git submodule add git://github.com/thecocktail/feedsucker.git vendor/plugins/feedsucker
And then:
script/generate feedsucker
Bugs & feedback
===============
ruby at listas dot the-cocktail dot com
Copyright (c) 2009 The Cocktail Experience S.L., released under the MIT license