ruby-oembed 0.14.1 → 0.15.0
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 +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.rdoc +13 -1
- data/lib/oembed.rb +1 -0
- data/lib/oembed/provider.rb +54 -5
- data/lib/oembed/providers.rb +39 -300
- data/lib/oembed/providers/aggregators/embedly_urls.yml +167 -6
- data/lib/oembed/providers/builtin_providers.rb +292 -0
- data/lib/oembed/providers/facebook_post.rb +27 -17
- data/lib/oembed/providers/facebook_video.rb +22 -10
- data/lib/oembed/providers/instagram.rb +37 -20
- data/lib/oembed/providers/tik_tok.rb +11 -0
- data/lib/oembed/version.rb +2 -2
- data/spec/cassettes/OEmbed_Provider.yml +117 -16
- data/spec/cassettes/OEmbed_Providers_CodePen.yml +177 -0
- data/spec/cassettes/OEmbed_Providers_FacebookPost.yml +539 -0
- data/spec/cassettes/OEmbed_Providers_FacebookVideo.yml +267 -0
- data/spec/cassettes/OEmbed_Providers_Instagram.yml +1473 -0
- data/spec/cassettes/OEmbed_Providers_Slideshare.yml +420 -834
- data/spec/cassettes/OEmbed_Providers_TikTok.yml +293 -0
- data/spec/cassettes/OEmbed_Providers_Twitter.yml +84 -357
- data/spec/cassettes/OEmbed_Providers_Youtube.yml +188 -26
- data/spec/provider_spec.rb +315 -138
- data/spec/providers/code_pen_spec.rb +21 -0
- data/spec/providers/facebook_post_spec.rb +54 -0
- data/spec/providers/facebook_video_spec.rb +48 -0
- data/spec/providers/instagram_spec.rb +48 -0
- data/spec/providers/slideshare_spec.rb +2 -9
- data/spec/providers/tik_tok_spec.rb +26 -0
- data/spec/providers/twitter_spec.rb +3 -10
- data/spec/providers/youtube_spec.rb +3 -9
- data/spec/providers_spec.rb +151 -16
- data/spec/response_spec.rb +2 -2
- data/spec/spec_helper.rb +19 -1
- data/spec/support/shared_examples_for_providers.rb +32 -20
- metadata +25 -5
- data/spec/providers/facebook_spec.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e3021fa6c864c1372498ae5f2467fc06fe430def7252f2301c7dbc955c8ec0a
|
4
|
+
data.tar.gz: b84a4dcb5fdeb59e3cd0bd0f1ce04eb66e43cca450f07f2eb5bb2fa8eb473a65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5e74bb8e0487882d07cb70ec920a967cd7e28ea5b404fc16a771d28a755ace31243ec83549691116c41f1c8acc04b7440890cf7ba9d055fb3f9130ec3928020
|
7
|
+
data.tar.gz: d48b92fb4a08e469dcfd74cd310a894dff0b54edd3c3496ca9ba6b1726e8a503cff98fb213d9258bae50ffd5dd332035322fe4c46428e04e1dd176dd50edccac
|
data/.travis.yml
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
= CHANGELOG
|
2
2
|
|
3
|
-
== Unreleased (0.
|
3
|
+
== Unreleased (0.15.1)
|
4
4
|
|
5
|
+
== 0.15.0 - 1 January 2021
|
6
|
+
|
7
|
+
* *DEPRECATION* When creating an `OEmbed::Provider` instance, specifying the format via positional argument is now deprecated. Please use a named argument instead: `OEmbed::Provider.new(@endpoint_url, format: :json)`
|
8
|
+
* *DEPRECATION* Do not use the `new` method for `Instagram`, `FacebookPost`, or `FacebookVideo` providers to set your access token. Instead either use the `OEMBED_FACEBOOK_TOKEN` environment variable or call `Instagram.access_token = @your_token`.
|
9
|
+
* Add built-in TikTok provider (Happy 2021)!
|
10
|
+
* Add support for Instgram Reels URLs to the built-in OEmbed::Providers::Instagram.
|
11
|
+
* Updated the list of {Embedly}[https://embed.ly/] and {Noembed}[https://noembed.com/] URL schemes.
|
12
|
+
* Fix Issue #77: Built-in Instagram & Facebook providers are now instances again.
|
13
|
+
* Add support for `OEmbed::Provider` instances with `required_query_params` (like access tokens), where the provider will fail to answer until it is fully configured.
|
14
|
+
* Support focused rspec tests for local development (e.g. "fcontext" or "fit")
|
15
|
+
* Fix a few typos in documentation & tests; Pull #76 (Inge Jørgensen)
|
5
16
|
|
6
17
|
== 0.14.1 - 28 December 2020
|
7
18
|
|
@@ -9,6 +20,7 @@
|
|
9
20
|
|
10
21
|
== 0.14.0 - 5 November 2020
|
11
22
|
|
23
|
+
* *BREAKING* Built-in providers for Instagram & Facebook are now classes, not instances, and therefore can't manually be registered via `OEmbed::Providers.register(OEmbed::Providers::Instagram)`; See Issue #77
|
12
24
|
* Add support for Facebook/Instagram access tokens; Pull #75 (Inge Jørgensen)
|
13
25
|
|
14
26
|
== 0.13.1 - 25 May 2020
|
data/lib/oembed.rb
CHANGED
@@ -8,6 +8,7 @@ require 'oembed/formatter'
|
|
8
8
|
require 'oembed/provider'
|
9
9
|
require 'oembed/provider_discovery'
|
10
10
|
require 'oembed/providers'
|
11
|
+
require 'oembed/providers/builtin_providers'
|
11
12
|
require 'oembed/response'
|
12
13
|
require 'oembed/response/photo'
|
13
14
|
require 'oembed/response/video'
|
data/lib/oembed/provider.rb
CHANGED
@@ -36,9 +36,15 @@ module OEmbed
|
|
36
36
|
# In actual requests to this Provider, this string will be replaced with a String
|
37
37
|
# representing the request format (e.g. "json").
|
38
38
|
#
|
39
|
-
#
|
39
|
+
# The `format:` option should be the name of the default format for all request
|
40
40
|
# to this Provider (e.g. 'json'). Defaults to OEmbed::Formatter.default
|
41
41
|
#
|
42
|
+
# # @deprecated *Note*: The `positional_format` is deprecated. Please used the named argument instead.
|
43
|
+
#
|
44
|
+
# The `required_query_params:` option should be a Hash
|
45
|
+
# representing query params that will be appended to the endpoint on each request
|
46
|
+
# and the optional name of an environment variable (i.e. ENV) whose value will be used
|
47
|
+
#
|
42
48
|
# For example:
|
43
49
|
# # If requests should be sent to:
|
44
50
|
# # "http://my.service.com/oembed?format=#{OEmbed::Formatter.default}"
|
@@ -46,14 +52,31 @@ module OEmbed
|
|
46
52
|
#
|
47
53
|
# # If requests should be sent to:
|
48
54
|
# # "http://my.service.com/oembed.xml"
|
49
|
-
# @xml_provider = OEmbed::Provider.new("http://my.service.com/oembed.{format}", :xml)
|
50
|
-
|
55
|
+
# @xml_provider = OEmbed::Provider.new("http://my.service.com/oembed.{format}", format: :xml)
|
56
|
+
#
|
57
|
+
# # If the endpoint requires an `access_token` be specified:
|
58
|
+
# @provider_with_auth = OEmbed::Provider.new("http://my.service.com/oembed", required_query_params: { access_token: 'MY_SERVICE_ACCESS_TOKEN' })
|
59
|
+
# # You can optionally override the value from `ENV['MY_SERVICE_ACCESS_TOKEN']`
|
60
|
+
# @provider_with_auth.access_token = @my_access_token
|
61
|
+
def initialize(endpoint, positional_format = OEmbed::Formatter.default, format: nil, required_query_params: {})
|
51
62
|
endpoint_uri = URI.parse(endpoint.gsub(/[\{\}]/,'')) rescue nil
|
52
63
|
raise ArgumentError, "The given endpoint isn't a valid http(s) URI: #{endpoint.to_s}" unless endpoint_uri.is_a?(URI::HTTP)
|
53
64
|
|
65
|
+
@required_query_params = {}
|
66
|
+
required_query_params.each do |param, default_env_var|
|
67
|
+
param = param.to_sym
|
68
|
+
@required_query_params[param] = nil
|
69
|
+
set_required_query_params(param, ENV[default_env_var]) if default_env_var
|
70
|
+
|
71
|
+
# Define a getter and a setter for each required_query_param
|
72
|
+
define_singleton_method("#{param}") { @required_query_params[param] } unless respond_to?("#{param}")
|
73
|
+
define_singleton_method("#{param}=") { |val| set_required_query_params(param, val) } unless respond_to?("#{param}=")
|
74
|
+
end
|
75
|
+
required_query_params_set?(reset_cache: true)
|
76
|
+
|
54
77
|
@endpoint = endpoint
|
55
78
|
@urls = []
|
56
|
-
@format = format
|
79
|
+
@format = format || positional_format
|
57
80
|
end
|
58
81
|
|
59
82
|
# Adds the given url scheme to this Provider instance.
|
@@ -75,6 +98,28 @@ module OEmbed
|
|
75
98
|
@urls << url
|
76
99
|
end
|
77
100
|
|
101
|
+
# Given the name of a required_query_param and a value
|
102
|
+
# store that value internally, so that it can be sent along
|
103
|
+
# with requests to this provider's endpoint.
|
104
|
+
# Raises an ArgumentError if the given param is not listed with required_query_params
|
105
|
+
# during instantiation.
|
106
|
+
def set_required_query_params(param, val)
|
107
|
+
raise ArgumentError.new("This provider does NOT have a required_query_param named #{param.inspect}") unless @required_query_params.has_key?(param)
|
108
|
+
|
109
|
+
@required_query_params[param] = val.nil? ? nil : ::CGI.escape(val.to_s)
|
110
|
+
|
111
|
+
required_query_params_set?(reset_cache: true)
|
112
|
+
|
113
|
+
@required_query_params[param]
|
114
|
+
end
|
115
|
+
|
116
|
+
# Returns true if all of this provider's required_query_params have a value
|
117
|
+
def required_query_params_set?(reset_cache: false)
|
118
|
+
return @all_required_query_params_set unless reset_cache || @all_required_query_params_set.nil?
|
119
|
+
|
120
|
+
@all_required_query_params_set = !@required_query_params.values.include?(nil)
|
121
|
+
end
|
122
|
+
|
78
123
|
# Send a request to the Provider endpoint to get information about the
|
79
124
|
# given url and return the appropriate OEmbed::Response.
|
80
125
|
#
|
@@ -92,7 +137,9 @@ module OEmbed
|
|
92
137
|
|
93
138
|
# Determine whether the given url is supported by this Provider by matching
|
94
139
|
# against the Provider's URL schemes.
|
140
|
+
# It will always return false of a provider has required_query_params that are not set.
|
95
141
|
def include?(url)
|
142
|
+
return false unless required_query_params_set?
|
96
143
|
@urls.empty? || !!@urls.detect{ |u| u =~ url }
|
97
144
|
end
|
98
145
|
|
@@ -100,10 +147,12 @@ module OEmbed
|
|
100
147
|
def build(url, query = {})
|
101
148
|
raise OEmbed::NotFound, url unless include?(url)
|
102
149
|
|
103
|
-
query = query.merge({:url => ::CGI.escape(url)})
|
104
150
|
query.delete(:timeout)
|
105
151
|
query.delete(:max_redirects)
|
106
152
|
|
153
|
+
query = query.merge(@required_query_params)
|
154
|
+
query = query.merge({:url => ::CGI.escape(url)})
|
155
|
+
|
107
156
|
# TODO: move this code exclusively into the get method, once build is private.
|
108
157
|
this_format = (query[:format] ||= @format.to_s).to_s
|
109
158
|
|
data/lib/oembed/providers.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'yaml'
|
3
3
|
|
4
|
-
require 'oembed/providers/facebook_post'
|
5
|
-
require 'oembed/providers/facebook_video'
|
6
|
-
require 'oembed/providers/instagram'
|
7
|
-
|
8
4
|
module OEmbed
|
9
5
|
# Allows OEmbed to perform tasks across several, registered, Providers
|
10
6
|
# at once.
|
@@ -13,6 +9,7 @@ module OEmbed
|
|
13
9
|
@@urls = {}
|
14
10
|
@@fallback = []
|
15
11
|
@@to_register = {}
|
12
|
+
@@access_token_setters = {}
|
16
13
|
|
17
14
|
# A Hash of all url schemes, where the keys represent schemes supported by
|
18
15
|
# all registered Provider instances and values are an Array of Providers
|
@@ -48,14 +45,14 @@ module OEmbed
|
|
48
45
|
# Register all Providers built into this gem.
|
49
46
|
# The including_sub_type parameter should be one of the following values:
|
50
47
|
# * :aggregators: also register provider aggregator endpoints, like Embedly
|
51
|
-
# The
|
48
|
+
# The access_tokens keys can be one of the following:
|
52
49
|
# * :facebook: See https://developers.facebook.com/docs/instagram/oembed#access-tokens
|
53
50
|
def register_all(*including_sub_type, access_tokens: {})
|
54
51
|
register(*@@to_register[""])
|
55
|
-
register_access_token_providers(access_tokens)
|
56
52
|
including_sub_type.each do |sub_type|
|
57
53
|
register(*@@to_register[sub_type.to_s])
|
58
54
|
end
|
55
|
+
set_access_tokens(access_tokens)
|
59
56
|
end
|
60
57
|
|
61
58
|
# Unregister all currently-registered Provider instances.
|
@@ -81,10 +78,19 @@ module OEmbed
|
|
81
78
|
@@fallback
|
82
79
|
end
|
83
80
|
|
84
|
-
# Returns a Provider instance
|
81
|
+
# Returns a Provider instance whose url scheme matches the given url.
|
82
|
+
# Skips any Provider with missing required_query_params.
|
85
83
|
def find(url)
|
86
|
-
|
87
|
-
|
84
|
+
@@urls.keys.each do |url_regexp|
|
85
|
+
next unless url_regexp.match?(url)
|
86
|
+
|
87
|
+
matching_provider = @@urls[url_regexp].detect { |p| p.include?(url) }
|
88
|
+
|
89
|
+
# If we've found a matching provider, return it right away!
|
90
|
+
return matching_provider if matching_provider
|
91
|
+
end
|
92
|
+
|
93
|
+
nil
|
88
94
|
end
|
89
95
|
|
90
96
|
# Finds the appropriate Provider for this url and return the raw response.
|
@@ -118,313 +124,46 @@ module OEmbed
|
|
118
124
|
private
|
119
125
|
|
120
126
|
# Takes an OEmbed::Provider instance and registers it so that when we call
|
121
|
-
# the register_all method, they all register.
|
127
|
+
# the register_all method, they all register.
|
128
|
+
# The sub_type can be be any value
|
122
129
|
# used to uniquely group providers. Official sub_types are:
|
123
130
|
# * nil: a normal provider
|
124
131
|
# * :aggregators: an endpoint for an OEmbed aggregator
|
125
|
-
|
132
|
+
# :access_token takes a Hash with the following required keys:
|
133
|
+
# * :name: A Symbol: the name of access token, to be used with `register_all`
|
134
|
+
# * :method: A Symbol: the name of the required_query_params for the access token.
|
135
|
+
def add_official_provider(provider_class, sub_type=nil, access_token: nil)
|
126
136
|
raise TypeError, "Expected OEmbed::Provider instance but was #{provider_class.class}" \
|
127
137
|
unless provider_class.is_a?(OEmbed::Provider)
|
128
138
|
|
129
139
|
@@to_register[sub_type.to_s] ||= []
|
130
140
|
@@to_register[sub_type.to_s] << provider_class
|
141
|
+
|
142
|
+
if access_token.is_a?(Hash) && access_token[:name] && access_token[:method]
|
143
|
+
setter_method = "#{access_token[:method]}="
|
144
|
+
raise TypeError, "Expected OEmbed::Provider instance to respond to the given access_token method #{setter_method}" \
|
145
|
+
unless provider_class.respond_to?(setter_method)
|
146
|
+
|
147
|
+
@@access_token_setters[access_token[:name]] ||= []
|
148
|
+
@@access_token_setters[access_token[:name]] << provider_class.method(setter_method)
|
149
|
+
end
|
131
150
|
end
|
132
151
|
|
133
|
-
# Takes a Hash of tokens, and
|
152
|
+
# Takes a Hash of tokens, and calls the setter method
|
153
|
+
# for all providers that use the given tokens.
|
134
154
|
# Also supports "OEMBED_*_TOKEN" environment variables.
|
135
155
|
# Currently supported tokens:
|
136
156
|
# * facebook: See https://developers.facebook.com/docs/instagram/oembed#access-tokens
|
137
|
-
def
|
138
|
-
|
157
|
+
def set_access_tokens(access_tokens)
|
158
|
+
access_tokens.each do |token_name, token_value|
|
159
|
+
token_name = token_name.to_sym
|
160
|
+
next unless @@access_token_setters.has_key?(token_name)
|
139
161
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
register OEmbed::Providers::Instagram.new(access_token: tokens[:facebook])
|
162
|
+
@@access_token_setters[token_name].each do |token_setter_method|
|
163
|
+
token_setter_method.call(token_value)
|
164
|
+
end
|
144
165
|
end
|
145
166
|
end
|
146
167
|
end
|
147
|
-
|
148
|
-
# Custom providers:
|
149
|
-
|
150
|
-
# Provider for youtube.com
|
151
|
-
# http://apiblog.youtube.com/2009/10/oembed-support.html
|
152
|
-
#
|
153
|
-
# Options:
|
154
|
-
# * To get the iframe embed code
|
155
|
-
# OEmbed::Providers::Youtube.endpoint += "?iframe=1"
|
156
|
-
# * To get the flash/object embed code
|
157
|
-
# OEmbed::Providers::Youtube.endpoint += "?iframe=0"
|
158
|
-
# * To require https embed code
|
159
|
-
# OEmbed::Providers::Youtube.endpoint += "?scheme=https"
|
160
|
-
Youtube = OEmbed::Provider.new("https://www.youtube.com/oembed/?scheme=https")
|
161
|
-
Youtube << "http://*.youtube.com/*"
|
162
|
-
Youtube << "https://*.youtube.com/*"
|
163
|
-
Youtube << "http://*.youtu.be/*"
|
164
|
-
Youtube << "https://*.youtu.be/*"
|
165
|
-
add_official_provider(Youtube)
|
166
|
-
|
167
|
-
# Provider for codepen.io
|
168
|
-
CodePen = OEmbed::Provider.new("https://codepen.io/api/oembed")
|
169
|
-
CodePen << "http://codepen.io/*"
|
170
|
-
CodePen << "https://codepen.io/*"
|
171
|
-
add_official_provider(CodePen)
|
172
|
-
|
173
|
-
# Provider for flickr.com
|
174
|
-
Flickr = OEmbed::Provider.new("https://www.flickr.com/services/oembed/")
|
175
|
-
Flickr << "http://*.flickr.com/*"
|
176
|
-
Flickr << "https://*.flickr.com/*"
|
177
|
-
Flickr << "http://flic.kr/*"
|
178
|
-
Flickr << "https://flic.kr/*"
|
179
|
-
add_official_provider(Flickr)
|
180
|
-
|
181
|
-
# Provider for viddler.com
|
182
|
-
# http://developers.viddler.com/documentation/services/oembed/
|
183
|
-
Viddler = OEmbed::Provider.new("http://lab.viddler.com/services/oembed/")
|
184
|
-
Viddler << "http://*.viddler.com/*"
|
185
|
-
add_official_provider(Viddler)
|
186
|
-
|
187
|
-
# Provider for qik.com
|
188
|
-
# http://qik.com/blog/qik-embraces-oembed-for-embedding-videos/
|
189
|
-
Qik = OEmbed::Provider.new("http://qik.com/api/oembed.{format}")
|
190
|
-
Qik << "http://qik.com/*"
|
191
|
-
Qik << "http://qik.com/video/*"
|
192
|
-
add_official_provider(Qik)
|
193
|
-
|
194
|
-
# Provider for revision3.com
|
195
|
-
Revision3 = OEmbed::Provider.new("http://revision3.com/api/oembed/")
|
196
|
-
Revision3 << "http://*.revision3.com/*"
|
197
|
-
add_official_provider(Revision3)
|
198
|
-
|
199
|
-
# Provider for hulu.com
|
200
|
-
Hulu = OEmbed::Provider.new("https://www.hulu.com/api/oembed.{format}")
|
201
|
-
Hulu << "http://www.hulu.com/watch/*"
|
202
|
-
Hulu << "https://www.hulu.com/watch/*"
|
203
|
-
add_official_provider(Hulu)
|
204
|
-
|
205
|
-
# Provider for vimeo.com
|
206
|
-
# https://developer.vimeo.com/apis/oembed
|
207
|
-
Vimeo = OEmbed::Provider.new("https://vimeo.com/api/oembed.{format}")
|
208
|
-
Vimeo << "http://*.vimeo.com/*"
|
209
|
-
Vimeo << "https://*.vimeo.com/*"
|
210
|
-
add_official_provider(Vimeo)
|
211
|
-
|
212
|
-
# Provider for twitter.com
|
213
|
-
# https://dev.twitter.com/rest/reference/get/statuses/oembed
|
214
|
-
Twitter = OEmbed::Provider.new("https://publish.twitter.com/oembed", :json)
|
215
|
-
Twitter << "https://*.twitter.com/*/status/*"
|
216
|
-
add_official_provider(Twitter)
|
217
|
-
|
218
|
-
# Provider for vine.co
|
219
|
-
# https://dev.twitter.com/web/vine/oembed
|
220
|
-
Vine = OEmbed::Provider.new("https://vine.co/oembed.{format}")
|
221
|
-
Vine << "http://*.vine.co/v/*"
|
222
|
-
Vine << "https://*.vine.co/v/*"
|
223
|
-
add_official_provider(Vine)
|
224
|
-
|
225
|
-
# Provider for slideshare.net
|
226
|
-
# http://www.slideshare.net/developers/oembed
|
227
|
-
Slideshare = OEmbed::Provider.new("https://www.slideshare.net/api/oembed/2")
|
228
|
-
Slideshare << 'http://*.slideshare.net/*/*'
|
229
|
-
Slideshare << 'https://*.slideshare.net/*/*'
|
230
|
-
Slideshare << 'http://*.slideshare.net/mobile/*/*'
|
231
|
-
Slideshare << 'https://*.slideshare.net/mobile/*/*'
|
232
|
-
add_official_provider(Slideshare)
|
233
|
-
|
234
|
-
# Provider for yfrog
|
235
|
-
# http://code.google.com/p/imageshackapi/wiki/OEMBEDSupport
|
236
|
-
Yfrog = OEmbed::Provider.new("https://www.yfrog.com/api/oembed", :json)
|
237
|
-
Yfrog << "http://yfrog.com/*"
|
238
|
-
add_official_provider(Yfrog)
|
239
|
-
|
240
|
-
# Provider for Giphy
|
241
|
-
Giphy = OEmbed::Provider.new("http://giphy.com/services/oembed")
|
242
|
-
Giphy << "http://giphy.com/*"
|
243
|
-
Giphy << "https://giphy.com/*"
|
244
|
-
add_official_provider(Giphy)
|
245
|
-
|
246
|
-
# Provider for imgur.com
|
247
|
-
Imgur = OEmbed::Provider.new("https://api.imgur.com/oembed.{format}")
|
248
|
-
Imgur << "https://*.imgur.com/gallery/*"
|
249
|
-
Imgur << "http://*.imgur.com/gallery/*"
|
250
|
-
add_official_provider(Imgur)
|
251
|
-
|
252
|
-
# Provider for Kickstarter
|
253
|
-
Kickstarter = OEmbed::Provider.new("https://www.kickstarter.com/services/oembed")
|
254
|
-
Kickstarter << "http://www.kickstarter.com/projects/*"
|
255
|
-
Kickstarter << "https://www.kickstarter.com/projects/*"
|
256
|
-
add_official_provider(Kickstarter)
|
257
|
-
|
258
|
-
# provider for mlg-tv
|
259
|
-
# http://tv.majorleaguegaming.com/oembed
|
260
|
-
MlgTv = OEmbed::Provider.new("http://tv.majorleaguegaming.com/oembed")
|
261
|
-
MlgTv << "http://tv.majorleaguegaming.com/video/*"
|
262
|
-
MlgTv << "http://mlg.tv/video/*"
|
263
|
-
add_official_provider(MlgTv)
|
264
|
-
|
265
|
-
# pownce.com closed in 2008
|
266
|
-
#Pownce = OEmbed::Provider.new("http://api.pownce.com/2.1/oembed.{format}")
|
267
|
-
#Pownce << "http://*.pownce.com/*"
|
268
|
-
#add_official_provider(Pownce)
|
269
|
-
|
270
|
-
# Provider for polleverywhere.com
|
271
|
-
PollEverywhere = OEmbed::Provider.new("http://www.polleverywhere.com/services/oembed/")
|
272
|
-
PollEverywhere << "http://www.polleverywhere.com/polls/*"
|
273
|
-
PollEverywhere << "http://www.polleverywhere.com/multiple_choice_polls/*"
|
274
|
-
PollEverywhere << "http://www.polleverywhere.com/free_text_polls/*"
|
275
|
-
add_official_provider(PollEverywhere)
|
276
|
-
|
277
|
-
# Provider for my.opera.com
|
278
|
-
# http://my.opera.com/devblog/blog/2008/12/02/embedding-my-opera-content-oembed
|
279
|
-
MyOpera = OEmbed::Provider.new("http://my.opera.com/service/oembed", :json)
|
280
|
-
MyOpera << "http://my.opera.com/*"
|
281
|
-
add_official_provider(MyOpera)
|
282
|
-
|
283
|
-
# Provider for clearspring.com
|
284
|
-
ClearspringWidgets = OEmbed::Provider.new("http://widgets.clearspring.com/widget/v1/oembed/")
|
285
|
-
ClearspringWidgets << "http://www.clearspring.com/widgets/*"
|
286
|
-
add_official_provider(ClearspringWidgets)
|
287
|
-
|
288
|
-
# Provider for nfb.ca
|
289
|
-
NFBCanada = OEmbed::Provider.new("http://www.nfb.ca/remote/services/oembed/")
|
290
|
-
NFBCanada << "http://*.nfb.ca/film/*"
|
291
|
-
add_official_provider(NFBCanada)
|
292
|
-
|
293
|
-
# Provider for scribd.com
|
294
|
-
Scribd = OEmbed::Provider.new("https://www.scribd.com/services/oembed")
|
295
|
-
Scribd << "http://*.scribd.com/*"
|
296
|
-
add_official_provider(Scribd)
|
297
|
-
|
298
|
-
# Provider for speakerdeck.com
|
299
|
-
# https://speakerdeck.com/faq#oembed
|
300
|
-
SpeakerDeck = OEmbed::Provider.new("https://speakerdeck.com/oembed.json")
|
301
|
-
SpeakerDeck << "http://speakerdeck.com/*/*"
|
302
|
-
SpeakerDeck << "https://speakerdeck.com/*/*"
|
303
|
-
add_official_provider(SpeakerDeck)
|
304
|
-
|
305
|
-
# Provider for movieclips.com
|
306
|
-
MovieClips = OEmbed::Provider.new("http://movieclips.com/services/oembed/")
|
307
|
-
MovieClips << "http://movieclips.com/watch/*/*/"
|
308
|
-
add_official_provider(MovieClips)
|
309
|
-
|
310
|
-
# Provider for 23hq.com
|
311
|
-
TwentyThree = OEmbed::Provider.new("http://www.23hq.com/23/oembed")
|
312
|
-
TwentyThree << "http://www.23hq.com/*"
|
313
|
-
add_official_provider(TwentyThree)
|
314
|
-
|
315
|
-
# Provider for soundcloud.com
|
316
|
-
# http://developers.soundcloud.com/docs/oembed
|
317
|
-
SoundCloud = OEmbed::Provider.new("https://soundcloud.com/oembed", :json)
|
318
|
-
SoundCloud << "http://*.soundcloud.com/*"
|
319
|
-
SoundCloud << "https://*.soundcloud.com/*"
|
320
|
-
add_official_provider(SoundCloud)
|
321
|
-
|
322
|
-
# Provider for spotify.com
|
323
|
-
# https://twitter.com/nicklas2k/status/330094611202723840
|
324
|
-
# http://blog.embed.ly/post/45149936446/oembed-for-spotify
|
325
|
-
Spotify = OEmbed::Provider.new("https://embed.spotify.com/oembed/")
|
326
|
-
Spotify << "http://open.spotify.com/*"
|
327
|
-
Spotify << "https://open.spotify.com/*"
|
328
|
-
Spotify << "http://play.spotify.com/*"
|
329
|
-
Spotify << "https://play.spotify.com/*"
|
330
|
-
Spotify << /^spotify\:(.*?)/
|
331
|
-
add_official_provider(Spotify)
|
332
|
-
|
333
|
-
# Provider for skitch.com
|
334
|
-
# http://skitch.com/oembed/%3C/endpoint
|
335
|
-
Skitch = OEmbed::Provider.new("http://skitch.com/oembed")
|
336
|
-
Skitch << "http://*.skitch.com/*"
|
337
|
-
Skitch << "https://*.skitch.com/*"
|
338
|
-
add_official_provider(Skitch)
|
339
|
-
|
340
|
-
# Provider for TED
|
341
|
-
Ted = OEmbed::Provider.new("https://www.ted.com/talks/oembed.{format}")
|
342
|
-
Ted << "http://*.ted.com/talks/*"
|
343
|
-
Ted << "https://*.ted.com/talks/*"
|
344
|
-
add_official_provider(Ted)
|
345
|
-
|
346
|
-
# Provider for tumblr.com
|
347
|
-
Tumblr = OEmbed::Provider.new("http://www.tumblr.com/oembed/1.0/", :json)
|
348
|
-
Tumblr << "http://*.tumblr.com/post/*"
|
349
|
-
Tumblr << "https://*.tumblr.com/post/*"
|
350
|
-
add_official_provider(Tumblr)
|
351
|
-
|
352
|
-
## Provider for clikthrough.com
|
353
|
-
# http://corporate.clikthrough.com/wp/?p=275
|
354
|
-
#Clickthrough = OEmbed::Provider.new("http://www.clikthrough.com/services/oembed/")
|
355
|
-
#Clickthrough << "http://*.clikthrough.com/theater/video/*"
|
356
|
-
#add_official_provider(Clickthrough)
|
357
|
-
|
358
|
-
## Provider for kinomap.com
|
359
|
-
# http://www.kinomap.com/#!oEmbed
|
360
|
-
#Kinomap = OEmbed::Provider.new("http://www.kinomap.com/oembed")
|
361
|
-
#Kinomap << "http://www.kinomap.com/*"
|
362
|
-
#add_official_provider(Kinomap)
|
363
|
-
|
364
|
-
# Provider for oohembed.com, which is a provider aggregator. See
|
365
|
-
# OEmbed::Providers::OohEmbed.urls for a full list of supported url schemas.
|
366
|
-
# Embed.ly has taken over the oohembed.com domain and as of July 20 all oohEmbed
|
367
|
-
# request will require you use an API key. For details on the transition see
|
368
|
-
# http://blog.embed.ly/oohembed
|
369
|
-
OohEmbed = OEmbed::Provider.new("http://oohembed.com/oohembed/", :json)
|
370
|
-
OohEmbed << "http://*.5min.com/Video/*" # micro-video host
|
371
|
-
OohEmbed << %r{http://(.*?).amazon.(com|co.uk|de|ca|jp)/(.*?)/(gp/product|o/ASIN|obidos/ASIN|dp)/(.*?)} # Online product shopping
|
372
|
-
OohEmbed << "http://*.blip.tv/*"
|
373
|
-
OohEmbed << "http://*.clikthrough.com/theater/video/*"
|
374
|
-
OohEmbed << "http://*.collegehumor.com/video:*" # Comedic & original videos
|
375
|
-
OohEmbed << "http://*.thedailyshow.com/video/*" # Syndicated show
|
376
|
-
OohEmbed << "http://*.dailymotion.com/*"
|
377
|
-
OohEmbed << "http://dotsub.com/view/*"
|
378
|
-
OohEmbed << "http://*.flickr.com/photos/*"
|
379
|
-
OohEmbed << "http://*.funnyordie.com/videos/*" # Comedy video host
|
380
|
-
OohEmbed << "http://video.google.com/videoplay?*" # Video hosting
|
381
|
-
OohEmbed << "http://www.hulu.com/watch/*"
|
382
|
-
OohEmbed << "http://*.kinomap.com/*"
|
383
|
-
OohEmbed << "http://*.livejournal.com/"
|
384
|
-
OohEmbed << "http://*.metacafe.com/watch/*" # Video host
|
385
|
-
OohEmbed << "http://*.nfb.ca/film/*"
|
386
|
-
OohEmbed << "http://*.photobucket.com/albums/*"
|
387
|
-
OohEmbed << "http://*.photobucket.com/groups/*"
|
388
|
-
OohEmbed << "http://*.phodroid.com/*/*/*" # Photo host
|
389
|
-
OohEmbed << "http://qik.com/*"
|
390
|
-
OohEmbed << "http://*.revision3.com/*"
|
391
|
-
OohEmbed << "http://*.scribd.com/*"
|
392
|
-
OohEmbed << "http://*.slideshare.net/*" # Share presentations online
|
393
|
-
OohEmbed << "http://*.twitpic.com/*" # Picture hosting for Twitter
|
394
|
-
OohEmbed << "http://twitter.com/*/statuses/*" # Mirco-blogging network
|
395
|
-
OohEmbed << "http://*.viddler.com/explore/*"
|
396
|
-
OohEmbed << "http://www.vimeo.com/*"
|
397
|
-
OohEmbed << "http://www.vimeo.com/groups/*/videos/*"
|
398
|
-
OohEmbed << "http://*.wikipedia.org/wiki/*" # Online encyclopedia
|
399
|
-
OohEmbed << "http://*.wordpress.com/*/*/*/*" # Blogging Engine & community
|
400
|
-
OohEmbed << "http://*.xkcd.com/*" # A hilarious stick figure comic
|
401
|
-
OohEmbed << %r{http://yfrog.(com|ru|com.tr|it|fr|co.il|co.uk|com.pl|pl|eu|us)/(.*?)} # image & video hosting
|
402
|
-
OohEmbed << "http://*.youtube.com/watch*"
|
403
|
-
|
404
|
-
# Provider for noembed.com, which is a provider aggregator. See
|
405
|
-
# OEmbed::Providers::Noembed.urls for a full list of supported url schemas.
|
406
|
-
# https://noembed.com/#supported-sites
|
407
|
-
Noembed = OEmbed::Provider.new("https://noembed.com/embed")
|
408
|
-
# Add all known URL regexps for Noembed.
|
409
|
-
# To update this list run `rake oembed:update_noembed`
|
410
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "/providers/aggregators/noembed_urls.yml")).each do |url|
|
411
|
-
Noembed << Regexp.new(url)
|
412
|
-
end
|
413
|
-
add_official_provider(Noembed, :aggregators)
|
414
|
-
|
415
|
-
# Provider for Embedly.com, which is a provider aggregator. See
|
416
|
-
# OEmbed::Providers::Embedly.urls for a full list of supported url schemas.
|
417
|
-
# http://embed.ly/docs/endpoints/1/oembed
|
418
|
-
#
|
419
|
-
# You can append your Embed.ly API key to the provider so that all requests are signed
|
420
|
-
# OEmbed::Providers::Embedly.endpoint += "?key=#{my_embedly_key}"
|
421
|
-
#
|
422
|
-
# If you don't yet have an API key you'll need to sign up here: http://embed.ly/pricing
|
423
|
-
Embedly = OEmbed::Provider.new("http://api.embed.ly/1/oembed")
|
424
|
-
# Add all known URL regexps for Embedly. To update this list run `rake oembed:update_embedly`
|
425
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "/providers/aggregators/embedly_urls.yml")).each do |url|
|
426
|
-
Embedly << url
|
427
|
-
end
|
428
|
-
add_official_provider(Embedly, :aggregators)
|
429
168
|
end
|
430
169
|
end
|