Skip to content

Cant parse media content #18

Open
Open

Description

@gdonnelly82

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

Activity

  1. kou commented on May 20, 2020

    @kou
    Member

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

  2. onli commented on Jun 4, 2020

    @onli

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

  3. kou commented on Jun 6, 2020

    @kou
    Member

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

  4. brentdodell commented on Oct 30, 2022

    @brentdodell

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

  5. christobh commented on Feb 27, 2023

    @christobh

    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

  6. jabbett commented on Apr 18, 2024

    @jabbett

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions