feedjira icon indicating copy to clipboard operation
feedjira copied to clipboard

parse youtube link

Open ipatovanton opened this issue 6 years ago • 3 comments

If I parse youtube link I have this error: undefined method `image' for #Feedjira::Parser::AtomYoutubeEntry:0x00007fa14be348d0

other links work

my code:

def self.add_entries(entries, stream_id)
      entries.each do |entry|
          unless  FeedEntry.where(guid: entry.id).exists?
            FeedEntry.create!(
              :name          => entry.title,
              :url           => entry.url,
              :summary       => entry.summary,
              :published_at  => entry.published,
              :enclosure_url => entry.image,
              :enclosure_type => entry.enclosure_type,
              :guid          => entry.id,
              :source_id => stream_id
            )
          end
      end
end

How to make to parse all links?

ipatovanton avatar Apr 05 '18 13:04 ipatovanton

Have a look at my answer on Stackoverflow. If you think this might be a bug, please provide us with some sample code including the sourcecode / url of a youtube feed for testing purposes.

PascalTurbo avatar Apr 05 '18 13:04 PascalTurbo

I think that instead of

element :"media:thumbnail", as: :media_thumbnail_url, value: :url
element :"media:thumbnail", as: :media_thumbnail_width, value: :width
element :"media:thumbnail", as: :media_thumbnail_height, value: :height

should be

element :"media:thumbnail", as: :image, value: :url
element :"media:thumbnail", as: :image, value: :width
element :"media:thumbnail", as: :image, value: :height

as in other parsers #408

ipatovanton avatar Apr 05 '18 13:04 ipatovanton

@mikeastock @HParker feedjira doesn't map values consequently. For "standard" feeds like feedburner or rss media:content is mapped to ìmage`, for itunes it is mapped to itunes_image. I think we should normalize this to image, but first with 3.0 because compatibility is not given.

PascalTurbo avatar Apr 05 '18 17:04 PascalTurbo