Sha256: 773ca110873d30434d15de9eaf0859e1df5ef0e67726c335000e18bf805b712c
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
require 'htmlentities' module Onebox module Engine class InstagramOnebox include Engine include StandardEmbed include LayoutSupport matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/[a-zA-Z0-9]+\/p\//) always_https def data og = get_opengraph title = og.title.split(":")[0].strip.gsub(" on Instagram", "") json_data = html_doc.xpath('//script[contains(text(),"window._sharedData")]').text.to_s title = "[Album] #{title}" if json_data =~ /"edge_sidecar_to_children"/ result = { link: og.url, title: Onebox::Helpers.truncate(title, 80), description: og.description(250) } result[:image] = og.image if !og.image.nil? result[:video_link] = og.url if !og.video_secure_url.nil? result end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
onebox-1.8.86 | lib/onebox/engine/instagram_onebox.rb |
onebox-1.8.85 | lib/onebox/engine/instagram_onebox.rb |