onebox 2.2.18 → 2.2.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onebox/engine/youtube_onebox.rb +11 -5
- data/lib/onebox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a892a3207f5adc40ff6c9924e52cfaa41e332c0890dfb52df2a15476900ec9a
|
4
|
+
data.tar.gz: 9fee19ab2aafa30845f6a44852e5ee6822fd702b762597740dee28c6136374ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dae1b6efe6dede26280478b904c9fa7fb128bdddc42f7b751b8acbaa80cbd1ba2b7717093105c12cef376fc754faf53f0fc5989fb94c9927925369c4f9527f7b
|
7
|
+
data.tar.gz: e5243223f4206de9b7bba0af587512dd786515f28687a5939b0cabfa71d91bc8742f0d75cbaffc272e8a6c00cae26feeca0999ebb7d611a650be2149ca718a99
|
@@ -89,25 +89,31 @@ module Onebox
|
|
89
89
|
|
90
90
|
def video_id
|
91
91
|
@video_id ||= begin
|
92
|
+
id = nil
|
93
|
+
|
92
94
|
# http://youtu.be/afyK1HSFfgw
|
93
95
|
if uri.host["youtu.be"]
|
94
96
|
id = uri.path[/\/([\w\-]+)/, 1]
|
95
|
-
return id if id
|
96
97
|
end
|
97
98
|
|
98
99
|
# https://www.youtube.com/embed/vsF0K3Ou1v0
|
99
100
|
if uri.path["/embed/"]
|
100
|
-
id
|
101
|
-
return id if id
|
101
|
+
id ||= uri.path[/\/embed\/([\w\-]+)/, 1]
|
102
102
|
end
|
103
103
|
|
104
104
|
# https://www.youtube.com/watch?v=Z0UISCEe52Y
|
105
|
-
params['v']
|
105
|
+
id ||= params['v']
|
106
|
+
|
107
|
+
sanitize_yt_id(id)
|
106
108
|
end
|
107
109
|
end
|
108
110
|
|
109
111
|
def list_id
|
110
|
-
@list_id ||= params['list']
|
112
|
+
@list_id ||= sanitize_yt_id(params['list'])
|
113
|
+
end
|
114
|
+
|
115
|
+
def sanitize_yt_id(raw)
|
116
|
+
raw&.match?(/\A[\w-]+\z/) ? raw : nil
|
111
117
|
end
|
112
118
|
|
113
119
|
def embed_params
|
data/lib/onebox/version.rb
CHANGED