Class: Onebox::Engine::InstagramOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::InstagramOnebox
- Includes:
- Onebox::Engine, StandardEmbed, LayoutSupport
- Defined in:
- lib/onebox/engine/instagram_onebox.rb
Constant Summary
Constants included from Onebox::Engine
Instance Attribute Summary
Attributes included from Onebox::Engine
Instance Method Summary collapse
Methods included from LayoutSupport
Methods included from StandardEmbed
add_oembed_provider, add_opengraph_provider, #always_https?, oembed_providers, opengraph_providers, #raw
Methods included from Onebox::Engine
engines, included, #initialize, #options, #options=, #placeholder_html, #to_html
Instance Method Details
#data ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/onebox/engine/instagram_onebox.rb', line 15 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 |