directlink 0.0.4.9 → 0.0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/directlink.gemspec +1 -1
- data/lib/directlink.rb +3 -4
- data/test.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28c72341721f49df103ccc53f2f1dc3a26a9d190
|
4
|
+
data.tar.gz: 8ef4bbacb9644c40f6cca2383794d3cecec71bc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d0be87dc287cf89fae211b2fb1b213b7be9ece2755b6ac3b9baefcf5f4ec8f75a83834984e81ffdde161b8656554f25a03c9a3240c89cc2ea7a7f7878be8b3e
|
7
|
+
data.tar.gz: a9a23ebe4e04ec82d02645d9000d7f71e7b3a5770707fe1791d3b8d40ddc652782319d724808aa78a5e0d42f3c491ba466075389d7f8ad8bb91c6e6b50a82849
|
data/directlink.gemspec
CHANGED
data/lib/directlink.rb
CHANGED
@@ -46,6 +46,7 @@ module DirectLink
|
|
46
46
|
/\A(https:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9_-]{11}\/W[a-zA-Z0-9_-]{9}I\/AAAAAAAA[a-zA-Z0-9_]{3}\/[a-zA-Z0-9_-]{32}[gwAQ]CJoC\/)w4\d\d-h318-n(\/[^\/]+)\z/,
|
47
47
|
/\A(https:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9_]{11}\/W[a-zA-Z0-9]{9}I\/AAAAAAAA[a-zA-Z0-9]{3}\/[a-zA-Z0-9_-]{32}[gw]CJoC\/)w48\d-h8\d\d-n(\/[^\/]+)\z/,
|
48
48
|
/\A(https:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9_-]{11}\/W[a-zA-Z0-9_-]{9}I\/AAAAAAA[a-zA-Z0-9_-]{4}\/[a-zA-Z0-9_-]{33}(?:CJoC|CL0B(?:GAs)?)\/)w530(?:-d)?-h[1-9]\d\d-n(\/[^\/]+)\z/,
|
49
|
+
/\A(https:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z0-9]{11}\/X[a-zA-Z0-9-]{9}I\/AAAAAAAAC0s\/[a-zA-Z0-9]{33}CJoC\/)w530-h[1-9]\d\d-n(\/[^\/]+)\z/,
|
49
50
|
/\A(https:\/\/lh3\.googleusercontent\.com\/-[a-zA-Z-]{11}\/W[a-zA-Z-]{9}I\/AAAAAAAA[a-zA-Z]{3}\/[a-zA-Z0-9_-]{32}ACJoC\/)w179-h318-n(\/[^\/]+)\z/
|
50
51
|
"#{$1}s#{width}#{$2}"
|
51
52
|
when /\A(\/\/lh3\.googleusercontent\.com\/proxy\/[a-zA-Z0-9_-]{66,523}=)(?:w(?:[45]\d\d)-h\d\d\d-[np]|s530-p|s110-p-k)\z/
|
@@ -195,8 +196,8 @@ module DirectLink
|
|
195
196
|
|
196
197
|
require "cgi"
|
197
198
|
def self.wiki link
|
198
|
-
raise ErrorBadLink.new link unless %r{\Ahttps?://([a-z]{2}\.wikipedia|commons.wikimedia)\.org/wiki(/[^/]+)*/(?<id>File:.+)} =~ link
|
199
|
-
t = JSON.load json = NetHTTPUtils.request_data( "https
|
199
|
+
raise ErrorBadLink.new link unless %r{\Ahttps?://(?<hostname>([a-z]{2}\.wikipedia|commons.wikimedia)\.org)/wiki(/[^/]+)*/(?<id>File:.+)} =~ link
|
200
|
+
t = JSON.load json = NetHTTPUtils.request_data( "https://#{hostname}/w/api.php", form: {
|
200
201
|
format: "json",
|
201
202
|
action: "query",
|
202
203
|
prop: "imageinfo",
|
@@ -295,8 +296,6 @@ def DirectLink link, max_redirect_resolving_retry_delay = nil, giveup = false
|
|
295
296
|
"User-Agent" => "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"
|
296
297
|
}, **(max_redirect_resolving_retry_delay ? {timeout: max_redirect_resolving_retry_delay, max_start_http_retry_delay: max_redirect_resolving_retry_delay, max_read_retry_delay: max_redirect_resolving_retry_delay} : {})
|
297
298
|
rescue Net::ReadTimeout
|
298
|
-
rescue NetHTTPUtils::Error => e
|
299
|
-
raise unless e.code == 401
|
300
299
|
else
|
301
300
|
link = case head.instance_variable_get(:@last_response).code
|
302
301
|
when "200" ; link
|
data/test.rb
CHANGED
@@ -147,6 +147,7 @@ describe DirectLink do
|
|
147
147
|
https://lh3.googleusercontent.com/-DLODAbD9W7E/W27ob5XGCOI/AAAAAAADV8g/J_6RYR6UkKsc2RJOWRx6Q-NBVx5RbMoxwCJoC/s0/1236080.jpg
|
148
148
|
https://lh3.googleusercontent.com/-cJajRreI87w/W4gW5uF4Q7I/AAAAAAADZKI/mw1YayYE-MY2-1OCCmjvgM3kbCK0lmIggCJoC/s0/2504855.jpg
|
149
149
|
https://lh3.googleusercontent.com/-rm-m1meCOMY/W92GhExMG-I/AAAAAAADsTw/bIAm5-1CIOYEpyPJLnxT8VmI_YNW2W5dACJoC/s0/2659806_800n.jpg
|
150
|
+
https://lh3.googleusercontent.com/-z1nwsq4NOT4/XETT5qhXP-I/AAAAAAAAC0s/03kJ22drB1EdqZ97gUXCPHkLZbbqrDbOACJoC/w530-h942-n/gplus1629127930.jpg
|
150
151
|
}.each_with_index do |link, i|
|
151
152
|
it "gpluscomm_105636351696833883213_86400 ##{i + 1}" do
|
152
153
|
assert DirectLink.google link
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: directlink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.
|
4
|
+
version: 0.0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Maslov aka Nakilon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|