Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant parse media content #18

Open
gdonnelly82 opened this issue May 20, 2020 · 6 comments
Open

Cant parse media content #18

gdonnelly82 opened this issue May 20, 2020 · 6 comments

Comments

@gdonnelly82
Copy link

gdonnelly82 commented May 20, 2020

I have been trying to parse media content and don't seem to be able to capture it. I can get the basics but trying to get something like the url of the image below throws an error.

<media:content url="https://static.independent.co.uk/s3fs-public/thumbnails/image/2020/03/10/14/payday-loans-5.jpg" type="image/jpeg" medium="image"/>

Example of code I'm trying.

require 'rss'

rss = RSS::Parser.parse('http://www.independent.co.uk/rss', false)

rss.items.each do |item|
  puts "#{item.title}"
  puts "#{item.media_content.url}"

end
@kou
Copy link
Member

kou commented May 20, 2020

We need to add support for Media RSS: https://www.rssboard.org/media-rss/

@onli
Copy link

onli commented Jun 4, 2020

Hi kou. Is that Media RSS support something you are planning to add? It would be very helpful!

@kou
Copy link
Member

kou commented Jun 6, 2020

I'll work on it when I can work on it.

@brentdodell
Copy link

I ran into this today. Has anyone else found an alternative gem that supports media:content and/or media:thumbnail?

@christobh
Copy link

I ran into this today. Has anyone else found an alternative gem that supports media:content and/or media:thumbnail?

Same... Seems still can't parse media content

@jabbett
Copy link

jabbett commented Apr 18, 2024

I ran into this today. Has anyone else found an alternative gem that supports media:content and/or media:thumbnail?

I have changed approaches - I'm using the Nori gem (https://github.com/savonrb/nori) to convert RSS into a hash and just navigate through it that way.

# load your RSS somehow then pass into Nori...
feed = Nori.new.parse(rss)
title = feed["rss"]["channel"]["title"]
description = feed["rss"]["channel"]["description"]
items = feed["rss"]["channel"]["item"]
items.each do |item|
  item_title = item["title"]
  content = item["content:encoded"]
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants