onebox 1.8.42 → 1.8.43

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e52fe88336fbc24e837ac26085947b02d5be731a
4
- data.tar.gz: 771027a17cb8e29343859f47b1fbf4c64feb47ef
2
+ SHA256:
3
+ metadata.gz: ab6d822ff9a5c357e658ab11a537e514dba47118480ea81376a5005099e7d420
4
+ data.tar.gz: 1050cbd743997007a39efa4be6262df691b587e24d9e8d2fe3841689e804257f
5
5
  SHA512:
6
- metadata.gz: b692e6c0489a207e8c82bcdb337ae714e34526895d01f614eec5eae356ed5825ae9b80c00e65c4a7a1cc77f9f21ea414ea44ed7177bc7e9b4ae19130f62bf591
7
- data.tar.gz: 2352ca96bc956ace63f1843997e47b75e4f50dbc6d4ff2202e7f3a3cb8e8488c64b1ed912aef35f14473a7f54fa84b10a73fba6ccdaebaf9da6a662468d9acc0
6
+ metadata.gz: ba4b4e815f643934ba11a35e90ecda36dc2800f6b0acaace94bd6582eda484c0f9bea3efac645c75366b80a838125614c3403df9b98503e9a09d817f02c7dd18
7
+ data.tar.gz: 65023e3bd3876f9f722a0098c8f91c5342091116f26e8cbad9b7c1d21c262dcc2f18bf4975969ed7195d3cd9e6da04a4f7644fabc17bb6f8848983b6baea17c2
data/lib/onebox/engine.rb CHANGED
@@ -182,3 +182,4 @@ require_relative "engine/trello_onebox"
182
182
  require_relative "engine/wechat_mp_onebox"
183
183
  require_relative "engine/cloudapp_onebox"
184
184
  require_relative "engine/wistia_onebox"
185
+ require_relative "engine/instagram_onebox"
@@ -0,0 +1,40 @@
1
+ require 'htmlentities'
2
+
3
+ module Onebox
4
+ module Engine
5
+ class InstagramOnebox
6
+ include Engine
7
+ include StandardEmbed
8
+ include LayoutSupport
9
+
10
+ matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)/)
11
+ always_https
12
+
13
+ def data
14
+ og = get_opengraph
15
+ title = og[:title].split(":")[0].strip
16
+ html_entities = HTMLEntities.new
17
+
18
+ json_data = html_doc.xpath('//script[contains(text(),"window._sharedData")]').text.to_s
19
+ title = "[Album] #{title}" if json_data =~ /"edge_sidecar_to_children"/
20
+
21
+ result = { link: og[:url],
22
+ title: html_entities.decode(Onebox::Helpers.truncate(title, 80)),
23
+ description: html_entities.decode(Sanitize.fragment(Onebox::Helpers.truncate(og[:description].strip, 250)))
24
+ }
25
+
26
+ if !Onebox::Helpers.blank?(og[:image])
27
+ result[:image] = ::Onebox::Helpers.normalize_url_for_output(og[:image])
28
+ end
29
+
30
+ if !Onebox::Helpers.blank?(og[:video_secure_url])
31
+ result[:video_width] = og[:video_width]
32
+ result[:video_height] = og[:video_height]
33
+ result[:video_secure_url] = ::Onebox::Helpers.normalize_url_for_output(og[:video_secure_url])
34
+ end
35
+
36
+ result
37
+ end
38
+ end
39
+ end
40
+ end
@@ -71,8 +71,6 @@ module Onebox
71
71
  ikea.com
72
72
  imdb.com
73
73
  indiatimes.com
74
- instagr.am
75
- instagram.com
76
74
  itunes.apple.com
77
75
  khanacademy.org
78
76
  kickstarter.com
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "1.8.42"
4
+ VERSION = "1.8.43"
5
5
  end
@@ -0,0 +1,13 @@
1
+ <h3><a href="{{link}}" target="_blank">{{title}}</a></h3>
2
+
3
+ {{#video_secure_url}}
4
+ <p><span class="instagram-images"><video class="instagram-image" width="{{video_width}}" height="{{video_height}}" controls loop>
5
+ <source src="{{video_secure_url}}" type='video/mp4'>
6
+ </video></span></p>
7
+ {{/video_secure_url}}
8
+
9
+ {{^video_secure_url}}
10
+ {{#image}}<p><span class="instagram-images"><img class="instagram-image" src="{{image}}"/></span></p>{{/image}}
11
+ {{/video_secure_url}}
12
+
13
+ <p><span class="instagram-description">{{description}}</span></p>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.42
4
+ version: 1.8.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-02-27 00:00:00.000000000 Z
13
+ date: 2018-03-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -325,6 +325,7 @@ files:
325
325
  - lib/onebox/engine/html.rb
326
326
  - lib/onebox/engine/image_onebox.rb
327
327
  - lib/onebox/engine/imgur_onebox.rb
328
+ - lib/onebox/engine/instagram_onebox.rb
328
329
  - lib/onebox/engine/json.rb
329
330
  - lib/onebox/engine/mixcloud_onebox.rb
330
331
  - lib/onebox/engine/opengraph_image.rb
@@ -379,6 +380,7 @@ files:
379
380
  - templates/githubpullrequest.mustache
380
381
  - templates/googledocs.mustache
381
382
  - templates/googleplayapp.mustache
383
+ - templates/instagram.mustache
382
384
  - templates/pastebin.mustache
383
385
  - templates/pdf.mustache
384
386
  - templates/pubmed.mustache
@@ -409,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
409
411
  version: '0'
410
412
  requirements: []
411
413
  rubyforge_project:
412
- rubygems_version: 2.6.13
414
+ rubygems_version: 2.7.4
413
415
  signing_key:
414
416
  specification_version: 4
415
417
  summary: A gem for generating embeddable HTML previews from URLs.