oembed_proxy 0.1.4 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -0
- data/.rubocop.yml +2 -2
- data/.travis.yml +2 -3
- data/CHANGELOG.md +29 -0
- data/Gemfile +1 -1
- data/README.md +7 -0
- data/lib/oembed_proxy.rb +1 -0
- data/lib/oembed_proxy/associated_press.rb +1 -1
- data/lib/oembed_proxy/fusiontable_map.rb +1 -1
- data/lib/oembed_proxy/google_document.rb +1 -1
- data/lib/oembed_proxy/google_spreadsheet.rb +1 -1
- data/lib/oembed_proxy/npr.rb +32 -0
- data/lib/oembed_proxy/tableau.rb +2 -2
- data/lib/oembed_proxy/version.rb +1 -1
- data/lib/providers/embedly_patterns.def +2 -8
- data/lib/providers/first_party.yml +15 -0
- data/oembed_proxy.gemspec +3 -5
- metadata +19 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4bef676640a2a836d69f273c78a2dc0417e01a20c8a6fe9fc025a48e403ccfd5
|
4
|
+
data.tar.gz: e477f25149723d797a3563543720cbc25dfb0a186e8e2ddf858c26e128b20814
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09246dbfefa1d3d92db62cecebc5ca25aa5c55b28f90703e83848d40882971ff43d861df0d2ca1e44ed193751764fc8d73ba2cd3f696e21d75709fe8af60e18f'
|
7
|
+
data.tar.gz: 7dcfd2de6c3eda158f01bc7f49234be8012dfcab20f593e7a3d10233119d464d0ef5fef3dc9a13c47377819821b6ffa2783303b858f371826f2f70d29156715c
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# oEmbed Proxy Changelog
|
2
2
|
|
3
|
+
## [`0.2.4`] (2020-07-30)
|
4
|
+
|
5
|
+
[`0.2.4`]: https://github.com/APMG/oembed_proxy/compare/v0.2.3...v0.2.4
|
6
|
+
|
7
|
+
* Move poll.fm from Embed.ly to First Party.
|
8
|
+
|
9
|
+
## [`0.2.3`] (2020-02-03)
|
10
|
+
|
11
|
+
[`0.2.3`]: https://github.com/APMG/oembed_proxy/compare/v0.2.2...v0.2.3
|
12
|
+
|
13
|
+
* Move Facebook from Embed.ly to First Party.
|
14
|
+
|
15
|
+
## [`0.2.2`] (2020-01-31)
|
16
|
+
|
17
|
+
[`0.2.2`]: https://github.com/APMG/oembed_proxy/compare/v0.2.0...v0.2.2
|
18
|
+
|
19
|
+
*Note: The 0.2.1 release had critical bugs and should not be used.*
|
20
|
+
|
21
|
+
* Add a new Fauxembed for NPR Sidechain embeds.
|
22
|
+
|
23
|
+
## [`0.2.0`] (2020-01-16)
|
24
|
+
|
25
|
+
[`0.2.0`]: https://github.com/APMG/oembed_proxy/compare/v0.1.3...v0.2.0
|
26
|
+
|
27
|
+
* Add Datawrapper to supported embed.ly embeds
|
28
|
+
* Updated Bundler requirement
|
29
|
+
* Rubocop upgrade to 0.78
|
30
|
+
* Modernizing Ruby versions in build
|
31
|
+
|
3
32
|
## [`0.1.3`] (2018-04-24)
|
4
33
|
|
5
34
|
[`0.1.3`]: https://github.com/APMG/oembed_proxy/compare/v0.1.2...v0.1.3
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -95,6 +95,13 @@ Once providers have been registered, calling `#handles_url?` and `#get_data` on
|
|
95
95
|
|
96
96
|
You are able to easily implement additional providers by creating an object which implements the `#handles_url?(url)` and `#get_data(url, other_params)` methods. Take a look at the existing provider classes for examples.
|
97
97
|
|
98
|
+
### Note on the NPR
|
99
|
+
|
100
|
+
The NPR embed is what we call a fauxembed. NPR does not implement the oembed
|
101
|
+
specification so we fake it by wrapping the embed url in a side-chain
|
102
|
+
element. Then you must load the NPR Sidechain library on your site. See
|
103
|
+
[Sidechain](https://github.com/nprapps/sidechain).
|
104
|
+
|
98
105
|
## Development
|
99
106
|
|
100
107
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Before sending a pull request, you will want to run `bin/rubocop` to lint your work.
|
data/lib/oembed_proxy.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module OembedProxy
|
4
4
|
# Associated Press Interactives Fauxembed
|
5
5
|
class AssociatedPress
|
6
|
-
AP_REGEX = %r{\Ahttps?:\/\/(?:hosted\.ap\.org\/interactives|interactives\.ap\.org)\/.+}
|
6
|
+
AP_REGEX = %r{\Ahttps?:\/\/(?:hosted\.ap\.org\/interactives|interactives\.ap\.org)\/.+}.freeze
|
7
7
|
|
8
8
|
def handles_url?(url)
|
9
9
|
!AP_REGEX.match(url).nil?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OembedProxy
|
4
4
|
# Google Apps Fusiontable Map Fauxembeds
|
5
5
|
class FusiontableMap
|
6
|
-
FUSIONTABLE_REGEX = %r{\Ahttps://www\.google\.com/fusiontables.+}
|
6
|
+
FUSIONTABLE_REGEX = %r{\Ahttps://www\.google\.com/fusiontables.+}.freeze
|
7
7
|
|
8
8
|
def handles_url?(url)
|
9
9
|
!(url =~ FUSIONTABLE_REGEX).nil?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OembedProxy
|
4
4
|
# Google Docs Fauxembed
|
5
5
|
class GoogleDocument
|
6
|
-
GOOGLE_DOCUMENT_REGEX = %r{\Ahttps://docs\.google\.com/document.+}
|
6
|
+
GOOGLE_DOCUMENT_REGEX = %r{\Ahttps://docs\.google\.com/document.+}.freeze
|
7
7
|
|
8
8
|
def handles_url?(url)
|
9
9
|
!(url =~ GOOGLE_DOCUMENT_REGEX).nil?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OembedProxy
|
4
4
|
# Google Spreadsheet Fauxembed
|
5
5
|
class GoogleSpreadsheet
|
6
|
-
GOOGLE_SPREADSHEET_REGEX = %r{\Ahttps://docs\.google\.com/spreadsheet.+}
|
6
|
+
GOOGLE_SPREADSHEET_REGEX = %r{\Ahttps://docs\.google\.com/spreadsheet.+}.freeze
|
7
7
|
|
8
8
|
def handles_url?(url)
|
9
9
|
!(url =~ GOOGLE_SPREADSHEET_REGEX).nil?
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'oembed_proxy/inactive_support'
|
4
|
+
|
5
|
+
module OembedProxy
|
6
|
+
# NPR Fauxembed
|
7
|
+
class Npr
|
8
|
+
using InactiveSupport
|
9
|
+
NPR_REGEX = %r{\Ahttps:\/\/(?:[a-z0-9-]+\.)+npr\.org\/.+}.freeze
|
10
|
+
|
11
|
+
def handles_url?(url)
|
12
|
+
!NPR_REGEX.match(url).nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_data(url, _other_params = {}) # rubocop:disable Metrics/MethodLength
|
16
|
+
return nil unless handles_url? url
|
17
|
+
|
18
|
+
escaped_url = url.gsub('"', '"')
|
19
|
+
{
|
20
|
+
'type' => 'rich',
|
21
|
+
'version' => '1.0',
|
22
|
+
'provider_name' => 'NPR',
|
23
|
+
'provider_url' => 'https://www.npr.org/',
|
24
|
+
'html' => <<~HTML,
|
25
|
+
<div class='sidechain-wrapper'>
|
26
|
+
<side-chain src="#{escaped_url}"></side-chain>
|
27
|
+
</div>
|
28
|
+
HTML
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/oembed_proxy/tableau.rb
CHANGED
@@ -7,7 +7,7 @@ module OembedProxy
|
|
7
7
|
class Tableau
|
8
8
|
using InactiveSupport
|
9
9
|
|
10
|
-
TABLEAU_REGEX = %r{\Ahttps://public\.tableau\.com/(?:profile/[^/]+/vizhome|views)/([^?]+)}
|
10
|
+
TABLEAU_REGEX = %r{\Ahttps://public\.tableau\.com/(?:profile/[^/]+/vizhome|views)/([^?]+)}.freeze
|
11
11
|
|
12
12
|
def handles_url?(url)
|
13
13
|
!TABLEAU_REGEX.match(url).nil?
|
@@ -26,7 +26,7 @@ module OembedProxy
|
|
26
26
|
'provider_url' => 'https://tableau.com/',
|
27
27
|
'width' => 500,
|
28
28
|
'height' => 500,
|
29
|
-
'html' => <<~HTML
|
29
|
+
'html' => <<~HTML,
|
30
30
|
<div id="#{div_id}"></div>
|
31
31
|
<script type="text/javascript" src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
|
32
32
|
<script type="text/javascript">
|
data/lib/oembed_proxy/version.rb
CHANGED
@@ -283,7 +283,6 @@
|
|
283
283
|
#\Ahttps?://(.+\.)?polldaddy\.com/poll/.*#i
|
284
284
|
#\Ahttps?://polldaddy\.com/poll/.*#i
|
285
285
|
#\Ahttps?://(.+\.)?polldaddy\.com/.*#i
|
286
|
-
#\Ahttp://poll\.fm/.*#i
|
287
286
|
#\Ahttp://answers\.polldaddy\.com/poll/.*#i
|
288
287
|
#\Ahttp://www\.5min\.com/Video/.*#i
|
289
288
|
#\Ahttp://www\.howcast\.com/videos/.*#i
|
@@ -600,13 +599,6 @@
|
|
600
599
|
#\Ahttp://boston\.com/video.*#i
|
601
600
|
#\Ahttp://www\.boston\.com/.*video.*#i
|
602
601
|
#\Ahttp://boston\.com/.*video.*#i
|
603
|
-
#\Ahttp://www\.facebook\.com/photo\.php.*#i
|
604
|
-
#\Ahttp://www\.facebook\.com/video/video\.php.*#i
|
605
|
-
#\Ahttp://www\.facebook\.com/v/.*#i
|
606
|
-
#\Ahttps://www\.facebook\.com/photo\.php.*#i
|
607
|
-
#\Ahttps://www\.facebook\.com/video/video\.php.*#i
|
608
|
-
#\Ahttps://www\.facebook\.com/v/.*#i
|
609
|
-
#\Ahttps://www\.facebook\.com/video.php\?v=.*#i
|
610
602
|
#\Ahttp://cnbc\.com/id/.*\?.*video.*#i
|
611
603
|
#\Ahttp://www\.cnbc\.com/id/.*\?.*video.*#i
|
612
604
|
#\Ahttp://cnbc\.com/id/.*/play/1/video/.*#i
|
@@ -647,3 +639,5 @@
|
|
647
639
|
#\Ahttp://bcove.me/.*#i
|
648
640
|
#\Ahttps://play\.radiopublic\.com/.*#i
|
649
641
|
#\Ahttps://www.qzzr.com/c/quiz/.*#i
|
642
|
+
#\Ahttp://datawrapper.dwcdn.net/.*#i
|
643
|
+
#\Ahttps://datawrapper.dwcdn.net/.*#i
|
@@ -58,6 +58,10 @@ polldaddy:
|
|
58
58
|
endpoint: "https://polldaddy.com/oembed/"
|
59
59
|
pattern_list: ["#\\Ahttps?://(?:[^.]+\\.)?polldaddy\\.com/.+#i"]
|
60
60
|
|
61
|
+
crowdsignal:
|
62
|
+
endpoint: "https://api.crowdsignal.com/oembed"
|
63
|
+
pattern_list: ["#\\Ahttps?://poll.fm/.+#i"]
|
64
|
+
|
61
65
|
funnyordie:
|
62
66
|
endpoint: "http://www.funnyordie.com/oembed"
|
63
67
|
pattern_list: ["#\\Ahttps?://(?:www\\.)?funnyordie\\.com/videos/.+#i"]
|
@@ -89,3 +93,14 @@ audio-api:
|
|
89
93
|
documentcloud:
|
90
94
|
endpoint: "https://www.documentcloud.org/api/oembed.json"
|
91
95
|
pattern_list: ["#\\Ahttps?://www\\.documentcloud\\.org/documents?/.+#i"]
|
96
|
+
|
97
|
+
|
98
|
+
# Facebook oEmbed documentation: https://developers.facebook.com/docs/plugins/oembed-endpoints/
|
99
|
+
|
100
|
+
facebook-video:
|
101
|
+
endpoint: "https://www.facebook.com/plugins/video/oembed.json"
|
102
|
+
pattern_list: ["#https://www\\.facebook\\.com/.+/videos/.+/#i", "#https://www\\.facebook\\.com/.+/videos/.+/#i", "#https://www\\.facebook\\.com/video\\.php\\?id=.+#i", "#https://www\\.facebook\\.com/video\\.php\\?v=.+#i"]
|
103
|
+
|
104
|
+
facebook-post:
|
105
|
+
endpoint: "https://www.facebook.com/plugins/post/oembed.json"
|
106
|
+
pattern_list: ["#https://www\\.facebook\\.com/.+/posts/.+#i", "#https://www\\.facebook\\.com/.+/posts/.+#i", "#https://www\\.facebook\\.com/.+/activity/.+#i", "#https://www\\.facebook\\.com/photo\\.php\\?fbid=.+#i", "#https://www\\.facebook\\.com/photos/.+#i", "#https://www\\.facebook\\.com/permalink\\.php\\?story_fbid=.+#i", "#https://www\\.facebook\\.com/media/set\\?set=.+#i", "#https://www\\.facebook\\.com/questions/.+#i", "#https://www\\.facebook\\.com/notes/.+/.+/.+#i"]
|
data/oembed_proxy.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
lib = File.expand_path('lib', __dir__)
|
@@ -8,8 +7,7 @@ require 'oembed_proxy/version'
|
|
8
7
|
Gem::Specification.new do |spec|
|
9
8
|
spec.name = 'oembed_proxy'
|
10
9
|
spec.version = OembedProxy::VERSION
|
11
|
-
spec.authors = ['
|
12
|
-
spec.email = ['wjohnston@mpr.org']
|
10
|
+
spec.authors = ['APM Digital Products Group']
|
13
11
|
|
14
12
|
spec.summary = 'Simple library to manage first party, embedly, and custom oembeds'
|
15
13
|
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
@@ -23,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
23
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
22
|
spec.require_paths = ['lib']
|
25
23
|
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
28
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oembed_proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- APM Digital Products Group
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.3'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 12.3.3
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
43
|
+
version: '12.3'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 12.3.3
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,9 +58,8 @@ dependencies:
|
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '3.0'
|
55
|
-
description:
|
61
|
+
description:
|
56
62
|
email:
|
57
|
-
- wjohnston@mpr.org
|
58
63
|
executables: []
|
59
64
|
extensions: []
|
60
65
|
extra_rdoc_files: []
|
@@ -82,6 +87,7 @@ files:
|
|
82
87
|
- lib/oembed_proxy/google_spreadsheet.rb
|
83
88
|
- lib/oembed_proxy/handler.rb
|
84
89
|
- lib/oembed_proxy/inactive_support.rb
|
90
|
+
- lib/oembed_proxy/npr.rb
|
85
91
|
- lib/oembed_proxy/oembed_exception.rb
|
86
92
|
- lib/oembed_proxy/tableau.rb
|
87
93
|
- lib/oembed_proxy/utility.rb
|
@@ -93,7 +99,7 @@ homepage: https://github.com/APMG/oembed_proxy
|
|
93
99
|
licenses:
|
94
100
|
- MIT
|
95
101
|
metadata: {}
|
96
|
-
post_install_message:
|
102
|
+
post_install_message:
|
97
103
|
rdoc_options: []
|
98
104
|
require_paths:
|
99
105
|
- lib
|
@@ -108,9 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
114
|
- !ruby/object:Gem::Version
|
109
115
|
version: '0'
|
110
116
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
signing_key:
|
117
|
+
rubygems_version: 3.0.3
|
118
|
+
signing_key:
|
114
119
|
specification_version: 4
|
115
120
|
summary: Simple library to manage first party, embedly, and custom oembeds
|
116
121
|
test_files: []
|