Do any Ruby RSS parsing libaries support MRSS?

回眸只為那壹抹淺笑 提交于 2020-01-15 05:43:46

问题


I'm attempting to parse Media RSS feeds that contain media:* elements, but it seems as though all of the standard RSS parsing libraries for Ruby only support enclosures, not MRSS elements.

I've tried:

  • SimpleRSS
  • RSS::Parser
  • Syndication:RSS::Parser

Ideally, I'd like something that makes it simple to extract elements such as media:thumbnail, similar to how I can extract an entry's enclosure.


回答1:


http://github.com/cardmagic/simple-rss seems to support Media RSS to some degree.

For example:

pp rss.entries.last
{
 ...
 :media_content_url=>"...",
 :media_content_type=>"image/jpeg",
 :media_content_height=>"426",
 :media_content_width=>"640",
 :media_thumbnail_url=>"...",
 :media_thumbnail_height=>"133",
 :media_thumbnail_width=>"200"}
}

(Unfortunately, with the feed I'm testing it with, it seems to be only taking the first media:content tag inside of the media:group, even though the media:group has 2 media:content tags.)



来源:https://stackoverflow.com/questions/2268224/do-any-ruby-rss-parsing-libaries-support-mrss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!