onebox 1.8.42 → 1.8.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/onebox/engine.rb +1 -0
- data/lib/onebox/engine/instagram_onebox.rb +40 -0
- data/lib/onebox/engine/whitelisted_generic_onebox.rb +0 -2
- data/lib/onebox/version.rb +1 -1
- data/templates/instagram.mustache +13 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab6d822ff9a5c357e658ab11a537e514dba47118480ea81376a5005099e7d420
|
4
|
+
data.tar.gz: 1050cbd743997007a39efa4be6262df691b587e24d9e8d2fe3841689e804257f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4b4e815f643934ba11a35e90ecda36dc2800f6b0acaace94bd6582eda484c0f9bea3efac645c75366b80a838125614c3403df9b98503e9a09d817f02c7dd18
|
7
|
+
data.tar.gz: 65023e3bd3876f9f722a0098c8f91c5342091116f26e8cbad9b7c1d21c262dcc2f18bf4975969ed7195d3cd9e6da04a4f7644fabc17bb6f8848983b6baea17c2
|
data/lib/onebox/engine.rb
CHANGED
@@ -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
|
data/lib/onebox/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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.
|