ruby-oembed 0.17.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +11 -1
- data/README.md +1 -1
- data/lib/oembed/http_helper.rb +7 -2
- data/lib/oembed/providers/builtin_providers.rb +2 -11
- data/lib/oembed/providers/spotify.rb +19 -0
- data/lib/oembed/version.rb +2 -2
- 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,16 @@
|
|
1
1
|
= CHANGELOG
|
2
2
|
|
3
|
-
== Unreleased (0.
|
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)
|
9
|
+
|
10
|
+
== 0.18.0 - 31 August 2024
|
11
|
+
|
12
|
+
* Add support for `x.com` URLs to `OEmbed::Providers::Twitter`; Pull #97 (Maxime)
|
13
|
+
* Refresh a few test casettes; Pull #96 (Marcos Wright-Kuhns)
|
4
14
|
|
5
15
|
== 0.17.0 - 25 February 2024
|
6
16
|
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Test Coverage](https://github.com/ruby-oembed/ruby-oembed/actions/workflows/ruby.yml/badge.svg)](https://github.com/ruby-oembed/ruby-oembed/actions/workflows/ruby.yml)
|
5
5
|
[![Code Climate](https://img.shields.io/codeclimate/maintainability/ruby-oembed/ruby-oembed.svg)](https://codeclimate.com/github/ruby-oembed/ruby-oembed)
|
6
6
|
[![Coveralls](https://coveralls.io/repos/github/ruby-oembed/ruby-oembed/badge.svg?branch=coveralls)](https://coveralls.io/github/ruby-oembed/ruby-oembed?branch=coveralls)
|
7
|
-
![Maintenance](https://img.shields.io/maintenance/yes/
|
7
|
+
![Maintenance](https://img.shields.io/maintenance/yes/2025.svg)
|
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
|
@@ -76,6 +77,7 @@ module OEmbed
|
|
76
77
|
# https://dev.twitter.com/rest/reference/get/statuses/oembed
|
77
78
|
Twitter = OEmbed::Provider.new("https://publish.twitter.com/oembed", format: :json)
|
78
79
|
Twitter << "https://*.twitter.com/*/status/*"
|
80
|
+
Twitter << "https://*.x.com/*/status/*"
|
79
81
|
add_official_provider(Twitter)
|
80
82
|
|
81
83
|
# Provider for vine.co
|
@@ -182,17 +184,6 @@ module OEmbed
|
|
182
184
|
SoundCloud << "https://*.soundcloud.com/*"
|
183
185
|
add_official_provider(SoundCloud)
|
184
186
|
|
185
|
-
# Provider for spotify.com
|
186
|
-
# https://twitter.com/nicklas2k/status/330094611202723840
|
187
|
-
# http://blog.embed.ly/post/45149936446/oembed-for-spotify
|
188
|
-
Spotify = OEmbed::Provider.new("https://embed.spotify.com/oembed/")
|
189
|
-
Spotify << "http://open.spotify.com/*"
|
190
|
-
Spotify << "https://open.spotify.com/*"
|
191
|
-
Spotify << "http://play.spotify.com/*"
|
192
|
-
Spotify << "https://play.spotify.com/*"
|
193
|
-
Spotify << /^spotify\:(.*?)/
|
194
|
-
add_official_provider(Spotify)
|
195
|
-
|
196
187
|
# Provider for skitch.com
|
197
188
|
# http://skitch.com/oembed/%3C/endpoint
|
198
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.
|
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.
|
107
|
+
- ruby-oembed-0.18.1
|
107
108
|
- "--inline-source"
|
108
109
|
- "--exclude"
|
109
110
|
- tasks
|