3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/feed_processor/mongo_feed_handler.rb', line 3
def process(url, feed)
f = Feed.create({:url => url, :status => 'to-process'})
entries = feed.entries
puts "found #{entries.length} entries in #{url}"
entries.each do |entry|
begin
f.contents.create({
:title => entry.title,
:url => entry.url,
:author => entry.author,
:summary => entry.summary,
:content => entry.content,
:published => entry.published,
:categories => entry.categories,
})
rescue => e
puts "error creating entry #{entry.url}: #{e.message}"
end
end
end
|