image-dumper 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2ace5b6364dd143c145f8e8c040daaa2891e431
4
- data.tar.gz: db1b3cb9161a80ceaaca7a560f17eff74b8b8fd4
3
+ metadata.gz: 540402d705c54203cf18d899ee74a5f9c4873920
4
+ data.tar.gz: 102783104ecaa46a5623fbf4d4af9e0a09ecd625
5
5
  SHA512:
6
- metadata.gz: 01e5d0b4c1249ddaaae309747928d08b6b3af951a95e6a419a32056010f608a2c3cf8327d62c0c4b9e6e54a8a949a900d9bb992c8d2c1251aee63b54dd7bde81
7
- data.tar.gz: 4ca442105386b638942697e516751a6444897f0b6325f2e47195ca10669fba46cd3f16236759ddc1c2a35be5ce562cb990c9cc51d281d2eba4e72a84ebdc6d18
6
+ metadata.gz: e600b4a39246d6471e7a58b9082cdadc58122e92746b889565f6d409812d175afb7bb9dd73509dcc808d0dd136c26827efa860fc6e161855b04a079d6c2e6af1
7
+ data.tar.gz: 88679f502090a13679ee8884a3ef363a2b06fe8bac7eb2847ebb6d01e57459c8df6e59b7a01e73feef824f11835a24e7111ace88865418f62dcbd1ca8ce3b8d1
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
2
+ # Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
3
3
  #
4
4
  # This file is part of Dumper.
5
5
  #
@@ -18,7 +18,7 @@
18
18
  #++
19
19
 
20
20
  module Dumper
21
- USER_AGENT = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0'
21
+ USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0'
22
22
 
23
23
  def pool_size
24
24
  {
@@ -94,21 +94,26 @@ module Dumper
94
94
  notify_observers error: "File #{filename} already exists."
95
95
  else
96
96
  filename = File.join(path, rand(1000).to_s + '.jpg') unless filename[-4] == ?. || filename[-5] == ?.
97
- notify_observers status: "Downloading #{url} as #{filename}..."
98
97
 
99
- url.prepend('http:') if url.start_with?('//')
100
- uri = URI(url)
101
98
  http_options = {
102
99
  'User-Agent' => options[:user_agent] || USER_AGENT,
103
100
  'Referer' => options[:referer ] || url
104
101
  }
105
102
 
106
- http = Net::HTTP.start(uri.host, uri.port)
103
+ url.prepend('http:') if url.start_with?('//')
104
+ uri = URI(url)
105
+
106
+ http = Net::HTTP.new(uri.host, uri.port)
107
107
  http.use_ssl = uri.scheme == 'https'
108
108
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
109
109
 
110
- File.open(filename, 'wb') do |f|
111
- f.write http.get(uri.path, http_options).body
110
+ http.start do |h|
111
+ notify_observers status: "Downloading #{url} as #{filename}..."
112
+ response = h.request Net::HTTP::Get.new(uri.request_uri, http_options)
113
+
114
+ File.open(filename, 'wb') do |f|
115
+ f.write response.body
116
+ end
112
117
  end
113
118
  end
114
119
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
2
+ # Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
3
3
  #
4
4
  # This file is part of Dumper.
5
5
  #
@@ -27,11 +27,11 @@ module Dumper
27
27
  end
28
28
 
29
29
  def log_on_file(file, data)
30
- File.open(file, ?a) { |file|
31
- data.each { |status, message|
30
+ File.open(file, ?a) do |file|
31
+ data.each do |status, message|
32
32
  file.puts status == :critical_error_dump ? message.inspect : message
33
- }
34
- }
33
+ end
34
+ end
35
35
  end
36
36
 
37
37
  def log_on_screen(data)
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Dumper
21
21
  def self.version
22
- '0.7.8'
22
+ '0.7.9'
23
23
  end
24
24
  end
@@ -14,7 +14,7 @@ describe 'Dumper' do
14
14
  end
15
15
 
16
16
  it 'dumps a page from teca' do
17
- url = 'http://alfateam123.niggazwithattitu.de/screens/anime_screens/sakura%20trick/index.html'
17
+ url = 'https://alfateam123.nwa.xyz/screens/anime_screens/sakura%20trick/index.html'
18
18
  Dumper::Profiles.get_teca url, @dir, 1, 4
19
19
 
20
20
  images = Dir["#{@dir}/*"]
@@ -25,4 +25,4 @@ describe 'Dumper' do
25
25
 
26
26
  expect(image.first).to be 1280
27
27
  end
28
- end
28
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image-dumper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri