lib/feed2gram/parses_entries.rb in feed2gram-1.1.0 vs lib/feed2gram/parses_entries.rb in feed2gram-1.2.0

- old
+ new

@@ -1,10 +1,10 @@ require "nokogiri" require "open-uri" module Feed2Gram - Media = Struct.new(:media_type, :url, keyword_init: true) do + Media = Struct.new(:media_type, :url, :cover_url, keyword_init: true) do def video? media_type == "VIDEO" end end Post = Struct.new(:media_type, :url, :medias, :caption, keyword_init: true) @@ -15,10 +15,11 @@ feed.xpath("//*:entry").map { |entry| html = Nokogiri::HTML(entry.xpath("*:content[1]").text) medias = html.xpath("//figure[1]/img").map { |img| Media.new( media_type: (img["data-media-type"] || "image").upcase, - url: img["src"] + url: img["src"], + cover_url: img["data-cover-url"] ) } Post.new( media_type: determine_post_media_type(html, medias),