Quantcast
Viewing all articles
Browse latest Browse all 30

Get Feeds source with Feedjira Gem

I use Feedjira Gem (Rails) to fetch/grab the rss-feeds from several websites. Everything works fine, but the only that has bugged me long time is the source-feed (the website I grab the rss from).

I want to show users which website the rss comes from. Right now, I grab the whole url, but I want to only grab what is after www and before .com. Anyway I can get it work or I can grab the feed source from the rss file.

I see this in rss file, but can't grab it.

<channel><link>http://www.domain.com/</link>

And here is my whole model.

class FeedEntry < ActiveRecord::Base  acts_as_punchable  def self.update_from_feed(feed_url)    feed = Feedjira::Feed.fetch_and_parse(feed_url)    add_entries(feed.entries)  end  private  def self.add_entries(entries)    entries.each do |entry|      unless exists? :guid => entry.id        create!(            :name         => entry.title,            :url          => entry.url,            :guid         => entry.id,            :source       => entry.url,            :summary      => entry.summary,            :published_at => entry.published,        )      end    end  endend

Thanks in advance!


Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>