feedjira
feedjira copied to clipboard
parse youtube link
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?
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.
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
@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.