1

I'm trying to parse an RSS file. It throws a 404 response when I do:

Feedjira::Feed.fetch_and_parse url

So I thought trying:

Feedjira::Parser::RSS.parse url

But that returns 0 entries

This is exactly what I'm trying:

<% Feedjira::Parser::RSS.parse("my url here").entries.each do |e| %>

    <%= "#{e.title}" %><br />

<% end %>

The rss file is being parse with no problem with php in another web. This is the structure:

    <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
        <channel>
            <title>Title here</title>
            ... etc ...
            <item>
                <title>Title here</title>
                 ... etc ...
            </item>
            <item> ... etc ... </item>
        </channel>
    </rss>
user2755140
  • 1,917
  • 4
  • 13
  • 16

1 Answers1

0

It's weird that Feedjira::Feed.fetch_and_parse url wasn't working for you. It's working perfectly fine for me.

Here's how I did it. I'm using Railscasts RSS feed for example purpose:

url = "http://railscasts.com/subscriptions/rZNfSBu1hH7hOwV1mjqyLw/episodes.rss"
feed = Feedjira::Feed.fetch_and_parse url

feed.entries.each do |entry|
  puts entry.title
end
Rahul Roy
  • 473
  • 1
  • 6
  • 17
  • Did you read the question? I'm trying to parse an RSS file. It throws a 404 response when I do: ``Feedjira::Feed.fetch_and_parse url``. It's the first thing I wrote. – user2755140 Jun 17 '15 at 19:39
  • @DaseinA My bad! Somehow I forgot the first part while trying out feedjira. Sorry for that :( – Rahul Roy Jun 17 '15 at 19:42
  • Are you sure you got it working with my **URL**? It keeps giving me the 404 response when I replace your url with mine. I'll award you with the best answer anyway because this seems to be a very different problem, rather related with IPs restrictions from my server or something. Thank you. – user2755140 Jun 17 '15 at 20:15
  • Yes. It got it working from the same URL(the one provided by you). Can't you tell it from the output? Thanks for choosing my answer. I'm glad that it helped. – Rahul Roy Jun 17 '15 at 20:18