0

I started to use feedjira. I'm getting entries from url:

feed = Feedjira::Feed.fetch_and_parse(self.url)

puts "Fetching from #{self.url}"

feed.entries.each do |entry|
  unless Feed.exists? guid: entry.id
    newFeed = Feed.create(name: entry.title,
                          summary: entry.summary,
                          url: entry.url,
                          published_at: entry.published,
                          guid: entry.id)

    self.feeds << newFeed
  end
end

I found these entries from tutorials. I haven't found entries from documentation. Are there any other entries that I can get from url like categories?

sawa
  • 165,429
  • 45
  • 277
  • 381
Mr.D
  • 7,353
  • 13
  • 60
  • 119

1 Answers1

0

From the source of feedjira, category is defined as categories for RSS feed.

elements :category, :as => :categories

The type of available elements depends on the source of the feed. (Atom/iTunes/FeedBurner)

So you can use author, content, updated, and image for RSS feed.

Ivan Chau
  • 1,403
  • 1
  • 18
  • 28
  • Thank you for answer. Does categories have some kind of standartized names or each site will write categories differently? – Mr.D Jun 17 '15 at 08:34
  • @Mr.D I'am afraid it is not the same. Keep in mind that [RSS spec](http://www.rssboard.org/rss-specification) only treated category as optional element. Even if RSS publisher provided the category information, it may be tags instead. – Ivan Chau Jun 17 '15 at 08:40
  • It throws me `NoMethodError: undefined method `categories' for #` error. But rss items in xml has category – Mr.D Jun 17 '15 at 09:11
  • @Mr.D Possible reason is that the feed is misclassified as ITunesRSSItem. You can try [patching the code by comment out the ITunesRSSItem line](https://github.com/feedjira/feedjira/issues/176#issuecomment-29171760) – Ivan Chau Jun 17 '15 at 09:35
  • @Mr.D Just paste the code in your ruby file to override the default setting. Less recommended way is to modify the original library. Path is feedjira/lib/feedjira/feed.rb – Ivan Chau Jun 17 '15 at 13:27