ruby-oembed 0.18.0 → 0.18.1
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/CHANGELOG.rdoc +6 -1
- data/README.md +1 -1
- data/lib/oembed/http_helper.rb +7 -2
- data/lib/oembed/providers/builtin_providers.rb +1 -11
- data/lib/oembed/providers/spotify.rb +19 -0
- data/lib/oembed/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fd19dd48be31e59b8f3ba84d08649883ca77fb4b83ddcc5a1755824ccbf84bd
|
|
4
|
+
data.tar.gz: 76989959365cd58bc897196fd6fbc808ce0d8c532b27f5cc3b934def57f58bbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6edcb673c5d7b0d24b2b514449f6ac983166d0e0c243641fc450781ffe73c75e58ed2f8d40d8706eceb5183e97a95973777531c92615fba94d9e0eb842481b06
|
|
7
|
+
data.tar.gz: 439e312c8debf3b6c5ec859392f1bd50bf63967b6eec3325b2b099e12894a63262622dec7602e8f6df464180a62aec5cd5679218191abd7c08315e4abb49e382
|
data/CHANGELOG.rdoc
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
= CHANGELOG
|
|
2
2
|
|
|
3
|
-
== Unreleased (0.18.
|
|
3
|
+
== Unreleased (0.18.2)
|
|
4
|
+
|
|
5
|
+
== 0.18.1 - 25 November 2024
|
|
6
|
+
|
|
7
|
+
* Fix the built-in Spotify provider; Pull #95 & #92 (Lewis Buckley)
|
|
8
|
+
* Update the built-in Spotify provider to use a new API endpoint; Pull #95 (Marcos Wright-Kuhns)
|
|
4
9
|
|
|
5
10
|
== 0.18.0 - 31 August 2024
|
|
6
11
|
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://github.com/ruby-oembed/ruby-oembed/actions/workflows/ruby.yml)
|
|
5
5
|
[](https://codeclimate.com/github/ruby-oembed/ruby-oembed)
|
|
6
6
|
[](https://coveralls.io/github/ruby-oembed/ruby-oembed?branch=coveralls)
|
|
7
|
-

|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
An oEmbed consumer library written in Ruby, letting you easily get embeddable HTML representations of supported web pages, based on their URLs. See [oembed.com](http://oembed.com) for more about the protocol.
|
data/lib/oembed/http_helper.rb
CHANGED
|
@@ -13,9 +13,10 @@ module OEmbed
|
|
|
13
13
|
def http_get(uri, options = {})
|
|
14
14
|
found = false
|
|
15
15
|
remaining_redirects = options[:max_redirects] ? options[:max_redirects].to_i : 4
|
|
16
|
+
scheme, host, port = uri.scheme, uri.host, uri.port
|
|
16
17
|
until found
|
|
17
|
-
http = Net::HTTP.new(
|
|
18
|
-
http.use_ssl =
|
|
18
|
+
http = Net::HTTP.new(host, port)
|
|
19
|
+
http.use_ssl = scheme == 'https'
|
|
19
20
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
20
21
|
http.read_timeout = http.open_timeout = options[:timeout] if options[:timeout]
|
|
21
22
|
|
|
@@ -33,6 +34,10 @@ module OEmbed
|
|
|
33
34
|
found = true
|
|
34
35
|
elsif res.is_a?(Net::HTTPRedirection) && res.header['location']
|
|
35
36
|
uri = URI.parse(res.header['location'])
|
|
37
|
+
# If the 'location' is a relative path, keep the last scheme, host, & port.
|
|
38
|
+
scheme = uri.scheme || scheme
|
|
39
|
+
host = uri.host || host
|
|
40
|
+
port = uri.port || port
|
|
36
41
|
remaining_redirects -= 1
|
|
37
42
|
else
|
|
38
43
|
found = true
|
|
@@ -6,6 +6,7 @@ require 'oembed/providers/facebook_post'
|
|
|
6
6
|
require 'oembed/providers/facebook_video'
|
|
7
7
|
require 'oembed/providers/instagram'
|
|
8
8
|
require 'oembed/providers/matterport'
|
|
9
|
+
require 'oembed/providers/spotify'
|
|
9
10
|
require 'oembed/providers/tiktok'
|
|
10
11
|
|
|
11
12
|
module OEmbed
|
|
@@ -183,17 +184,6 @@ module OEmbed
|
|
|
183
184
|
SoundCloud << "https://*.soundcloud.com/*"
|
|
184
185
|
add_official_provider(SoundCloud)
|
|
185
186
|
|
|
186
|
-
# Provider for spotify.com
|
|
187
|
-
# https://twitter.com/nicklas2k/status/330094611202723840
|
|
188
|
-
# http://blog.embed.ly/post/45149936446/oembed-for-spotify
|
|
189
|
-
Spotify = OEmbed::Provider.new("https://embed.spotify.com/oembed/")
|
|
190
|
-
Spotify << "http://open.spotify.com/*"
|
|
191
|
-
Spotify << "https://open.spotify.com/*"
|
|
192
|
-
Spotify << "http://play.spotify.com/*"
|
|
193
|
-
Spotify << "https://play.spotify.com/*"
|
|
194
|
-
Spotify << /^spotify\:(.*?)/
|
|
195
|
-
add_official_provider(Spotify)
|
|
196
|
-
|
|
197
187
|
# Provider for skitch.com
|
|
198
188
|
# http://skitch.com/oembed/%3C/endpoint
|
|
199
189
|
Skitch = OEmbed::Provider.new("http://skitch.com/oembed")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module OEmbed
|
|
2
|
+
class Providers
|
|
3
|
+
# Provider for spotify.com
|
|
4
|
+
# https://developer.spotify.com/documentation/embeds/reference/oembed
|
|
5
|
+
# https://developer.spotify.com/documentation/embeds/tutorials/using-the-oembed-api
|
|
6
|
+
Spotify = OEmbed::Provider.new(
|
|
7
|
+
"https://open.spotify.com/oembed",
|
|
8
|
+
format: :json
|
|
9
|
+
)
|
|
10
|
+
Spotify << "http://open.spotify.com/*"
|
|
11
|
+
Spotify << "https://open.spotify.com/*"
|
|
12
|
+
Spotify << "http://play.spotify.com/*"
|
|
13
|
+
Spotify << "https://play.spotify.com/*"
|
|
14
|
+
# https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids
|
|
15
|
+
Spotify << /^spotify\:(.*?)/
|
|
16
|
+
|
|
17
|
+
add_official_provider(Spotify)
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/oembed/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-oembed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.18.
|
|
4
|
+
version: 0.18.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Magnus Holm
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2024-
|
|
14
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: xml-simple
|
|
@@ -84,6 +84,7 @@ files:
|
|
|
84
84
|
- lib/oembed/providers/facebook_video.rb
|
|
85
85
|
- lib/oembed/providers/instagram.rb
|
|
86
86
|
- lib/oembed/providers/matterport.rb
|
|
87
|
+
- lib/oembed/providers/spotify.rb
|
|
87
88
|
- lib/oembed/providers/tiktok.rb
|
|
88
89
|
- lib/oembed/response.rb
|
|
89
90
|
- lib/oembed/response/link.rb
|
|
@@ -103,7 +104,7 @@ rdoc_options:
|
|
|
103
104
|
- "--main"
|
|
104
105
|
- README.rdoc
|
|
105
106
|
- "--title"
|
|
106
|
-
- ruby-oembed-0.18.
|
|
107
|
+
- ruby-oembed-0.18.1
|
|
107
108
|
- "--inline-source"
|
|
108
109
|
- "--exclude"
|
|
109
110
|
- tasks
|