image-dumper 0.5.5 → 0.6

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dumper +47 -40
  3. data/lib/dumper.rb +38 -36
  4. data/lib/dumper/dumper.rb +114 -52
  5. data/lib/dumper/profiles/4chan.rb +49 -33
  6. data/lib/dumper/profiles/behoimi.rb +48 -38
  7. data/lib/dumper/profiles/booru.rb +54 -40
  8. data/lib/dumper/profiles/deviantart.rb +49 -33
  9. data/lib/dumper/profiles/fakku.rb +61 -51
  10. data/lib/dumper/profiles/fc2.rb +49 -33
  11. data/lib/dumper/profiles/gelbooru.rb +54 -40
  12. data/lib/dumper/profiles/imagebam.rb +55 -37
  13. data/lib/dumper/profiles/mangaeden.rb +69 -53
  14. data/lib/dumper/profiles/mangago.rb +53 -40
  15. data/lib/dumper/profiles/mangahere.rb +68 -49
  16. data/lib/dumper/profiles/multiplayer.rb +55 -41
  17. data/lib/dumper/profiles/redblow.rb +49 -36
  18. data/lib/dumper/profiles/sankakucomplex.rb +81 -58
  19. data/lib/dumper/profiles/teca.rb +54 -34
  20. data/lib/dumper/profiles/yande.rb +51 -42
  21. data/lib/dumper/utils.rb +40 -42
  22. data/lib/dumper/version.rb +23 -23
  23. data/spec/4chan_spec.rb +28 -0
  24. data/spec/behoimi_spec.rb +28 -0
  25. data/spec/booru_spec.rb +28 -0
  26. data/spec/deviantart_spec.rb +28 -0
  27. data/spec/fakku_spec.rb +28 -0
  28. data/spec/fc2_spec.rb +28 -0
  29. data/spec/gelbooru_spec.rb +28 -0
  30. data/spec/imagebam_spec.rb +28 -0
  31. data/spec/mangaeden_spec.rb +28 -0
  32. data/spec/mangago_spec.rb +28 -0
  33. data/spec/mangahere_spec.rb +28 -0
  34. data/spec/multiplayer_spec.rb +28 -0
  35. data/spec/redblow_spec.rb +28 -0
  36. data/spec/sankakucomplex_spec.rb +41 -0
  37. data/spec/teca_spec.rb +28 -0
  38. data/spec/yande_spec.rb +28 -0
  39. metadata +119 -6
  40. data/lib/dumper/profiles/i_doujin.rb +0 -38
  41. data/lib/dumper/profiles/mi9.rb +0 -44
  42. data/lib/dumper/profiles/wallpaperhere.rb +0 -43
@@ -0,0 +1,28 @@
1
+ #! /usr/bin/env ruby
2
+ require 'dumper'
3
+ require 'fastimage'
4
+ require 'fileutils'
5
+
6
+ describe 'Dumper' do
7
+ before do
8
+ @dir = 'tmp_multiplayer'
9
+ Dir.mkdir @dir
10
+ end
11
+
12
+ after do
13
+ FileUtils.rm_r @dir
14
+ end
15
+
16
+ it 'dumps a page from multiplayer' do
17
+ url = 'http://multiplayer.it/giochi/the-witcher-3-wild-hunt-per-pc.html'
18
+ Dumper::Profiles.get_multiplayer url, @dir, 60, 66
19
+
20
+ images = Dir["#{@dir}/*"]
21
+ expect(images.length).to be 7
22
+
23
+ image = FastImage.size images.last
24
+ expect(image).to be_kind_of(Array)
25
+
26
+ expect(image.first).to be 650
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ #! /usr/bin/env ruby
2
+ require 'dumper'
3
+ require 'fastimage'
4
+ require 'fileutils'
5
+
6
+ describe 'Dumper' do
7
+ before do
8
+ @dir = 'tmp_redblow'
9
+ Dir.mkdir @dir
10
+ end
11
+
12
+ after do
13
+ FileUtils.rm_r @dir
14
+ end
15
+
16
+ it 'dumps a page from redblow' do
17
+ url = 'http://www.redblow.com/asuka-kirara-in-black-dress/'
18
+ Dumper::Profiles.get_redblow url, @dir, 1, 3
19
+
20
+ images = Dir["#{@dir}/*"]
21
+ expect(images.length).to be 3
22
+
23
+ image = FastImage.size images.last
24
+ expect(image).to be_kind_of(Array)
25
+
26
+ expect(image.first).to be 800
27
+ end
28
+ end
@@ -0,0 +1,41 @@
1
+ #! /usr/bin/env ruby
2
+ require 'dumper'
3
+ require 'fastimage'
4
+ require 'fileutils'
5
+
6
+ describe 'Dumper' do
7
+ before do
8
+ @dir = 'tmp_sankakucomplex'
9
+ Dir.mkdir @dir
10
+ end
11
+
12
+ after do
13
+ FileUtils.rm_r @dir
14
+ end
15
+
16
+ it 'dumps images from sankakucomplex' do
17
+ url = 'http://www.sankakucomplex.com/2014/01/25/maken-ki-lustier-than-ever/'
18
+ Dumper::Profiles.get_sankakucomplex url, @dir, 1, 3
19
+
20
+ images = Dir["#{@dir}/*"]
21
+ expect(images.length).to be 3
22
+
23
+ image = FastImage.size images.last
24
+ expect(image).to be_kind_of(Array)
25
+
26
+ expect(image.first).to be 400
27
+ end
28
+
29
+ it 'dumps images from chan.sankakucomplex' do
30
+ url = 'http://chan.sankakucomplex.com/?tags=otonashi_kotori'
31
+ Dumper::Profiles.get_sankakucomplex url, @dir
32
+
33
+ images = Dir["#{@dir}/*"]
34
+ expect(images.length).to be 20
35
+
36
+ image = FastImage.size images.last
37
+ expect(image).to be_kind_of(Array)
38
+
39
+ expect(image.first).to be >= 400
40
+ end
41
+ end
data/spec/teca_spec.rb ADDED
@@ -0,0 +1,28 @@
1
+ #! /usr/bin/env ruby
2
+ require 'dumper'
3
+ require 'fastimage'
4
+ require 'fileutils'
5
+
6
+ describe 'Dumper' do
7
+ before do
8
+ @dir = 'tmp_teca'
9
+ Dir.mkdir @dir
10
+ end
11
+
12
+ after do
13
+ FileUtils.rm_r @dir
14
+ end
15
+
16
+ it 'dumps a page from teca' do
17
+ url = 'http://alfateam123.niggazwithattitu.de/screens/anime_screens/sakura%20trick/index.html'
18
+ Dumper::Profiles.get_teca url, @dir, 1, 4
19
+
20
+ images = Dir["#{@dir}/*"]
21
+ expect(images.length).to be 4
22
+
23
+ image = FastImage.size images.last
24
+ expect(image).to be_kind_of(Array)
25
+
26
+ expect(image.first).to be 1280
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ #! /usr/bin/env ruby
2
+ require 'dumper'
3
+ require 'fastimage'
4
+ require 'fileutils'
5
+
6
+ describe 'Dumper' do
7
+ before do
8
+ @dir = 'tmp_yande'
9
+ Dir.mkdir @dir
10
+ end
11
+
12
+ after do
13
+ FileUtils.rm_r @dir
14
+ end
15
+
16
+ it 'dumps a page from yandere' do
17
+ url = 'https://yande.re/post?tags=aragaki_ayase'
18
+ Dumper::Profiles.get_yande url, @dir, 2, 2
19
+
20
+ images = Dir["#{@dir}/*"]
21
+ expect(images.length).to be 16
22
+
23
+ image = FastImage.size images.last
24
+ expect(image).to be_kind_of(Array)
25
+
26
+ expect(image.first).to be > 300
27
+ 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.5.5
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-14 00:00:00.000000000 Z
11
+ date: 2014-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -52,6 +52,90 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thread
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: fastimage
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: parallel_tests
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
55
139
  description: A dumper to download whole galleries from board like 4chan, imagebam,
56
140
  mangaeden, deviantart, etc.
57
141
  email: webmaster@giovannicapuano.net
@@ -69,20 +153,33 @@ files:
69
153
  - lib/dumper/profiles/fc2.rb
70
154
  - lib/dumper/profiles/gelbooru.rb
71
155
  - lib/dumper/profiles/imagebam.rb
72
- - lib/dumper/profiles/i_doujin.rb
73
156
  - lib/dumper/profiles/mangaeden.rb
74
157
  - lib/dumper/profiles/mangago.rb
75
158
  - lib/dumper/profiles/mangahere.rb
76
- - lib/dumper/profiles/mi9.rb
77
159
  - lib/dumper/profiles/multiplayer.rb
78
160
  - lib/dumper/profiles/redblow.rb
79
161
  - lib/dumper/profiles/sankakucomplex.rb
80
162
  - lib/dumper/profiles/teca.rb
81
- - lib/dumper/profiles/wallpaperhere.rb
82
163
  - lib/dumper/profiles/yande.rb
83
164
  - lib/dumper/utils.rb
84
165
  - lib/dumper/version.rb
85
166
  - lib/dumper.rb
167
+ - spec/4chan_spec.rb
168
+ - spec/behoimi_spec.rb
169
+ - spec/booru_spec.rb
170
+ - spec/deviantart_spec.rb
171
+ - spec/fakku_spec.rb
172
+ - spec/fc2_spec.rb
173
+ - spec/gelbooru_spec.rb
174
+ - spec/imagebam_spec.rb
175
+ - spec/mangaeden_spec.rb
176
+ - spec/mangago_spec.rb
177
+ - spec/mangahere_spec.rb
178
+ - spec/multiplayer_spec.rb
179
+ - spec/redblow_spec.rb
180
+ - spec/sankakucomplex_spec.rb
181
+ - spec/teca_spec.rb
182
+ - spec/yande_spec.rb
86
183
  - bin/dumper
87
184
  homepage: http://www.giovannicapuano.net
88
185
  licenses:
@@ -108,4 +205,20 @@ rubygems_version: 2.0.3
108
205
  signing_key:
109
206
  specification_version: 4
110
207
  summary: Fetch and download image gallery.
111
- test_files: []
208
+ test_files:
209
+ - spec/4chan_spec.rb
210
+ - spec/behoimi_spec.rb
211
+ - spec/booru_spec.rb
212
+ - spec/deviantart_spec.rb
213
+ - spec/fakku_spec.rb
214
+ - spec/fc2_spec.rb
215
+ - spec/gelbooru_spec.rb
216
+ - spec/imagebam_spec.rb
217
+ - spec/mangaeden_spec.rb
218
+ - spec/mangago_spec.rb
219
+ - spec/mangahere_spec.rb
220
+ - spec/multiplayer_spec.rb
221
+ - spec/redblow_spec.rb
222
+ - spec/sankakucomplex_spec.rb
223
+ - spec/teca_spec.rb
224
+ - spec/yande_spec.rb
@@ -1,38 +0,0 @@
1
- #--
2
- # Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
3
- #
4
- # This file is part of Dumper.
5
- #
6
- # Dumper is free software: you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation, either version 3 of the License, or
9
- # (at your option) any later version.
10
- #
11
- # Dumper is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
- #
16
- # You should have received a copy of the GNU General Public License
17
- # along with Dumper. If not, see <http://www.gnu.org/licenses/>.
18
- #++
19
-
20
- module Dumper
21
- module Profiles
22
-
23
- def self.get_i_doujin(url, path, from = 1, to = 1)
24
- url = url.scan(/(.*?)\/p\:/).first.first if url.include? '/p:'
25
-
26
- pages = Nokogiri::HTML(open("#{url}/p:1")).xpath('//div[@class="pager-navigation"]').text.split(?/)[1].scan(/\d+/)[0].to_i
27
-
28
- 1.upto(pages) { |i|
29
- self.get path, Nokogiri::HTML(open("#{url}/p:#{i}")).xpath('//div[@class="doujin-img-view"]/img/@src')[0]
30
- }
31
- end
32
-
33
- def self.info_i_doujin
34
- { :from => false, :to => false }
35
- end
36
-
37
- end
38
- end
@@ -1,44 +0,0 @@
1
- #--
2
- # Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
3
- #
4
- # This file is part of Dumper.
5
- #
6
- # Dumper is free software: you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation, either version 3 of the License, or
9
- # (at your option) any later version.
10
- #
11
- # Dumper is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
- #
16
- # You should have received a copy of the GNU General Public License
17
- # along with Dumper. If not, see <http://www.gnu.org/licenses/>.
18
- #++
19
-
20
- module Dumper
21
- module Profiles
22
-
23
- def self.get_mi9(url, path, from = 1, to = 1)
24
- url = url[0..-2] if url.end_with? ?/
25
-
26
- from.upto(to) { |page|
27
- u = url + ( page == 1 ? ?/ : "_#{page}/" )
28
- Nokogiri::HTML(open(u)).xpath('//a[@target="_blank"]/@href').each { |p|
29
- next unless p.to_s.start_with? 'http://mi9.com/wallpaper/'
30
- Nokogiri::HTML(open(p.to_s)).xpath('//div[@class="s_infox down"]/span/a/@href').each { |q|
31
- Nokogiri::HTML(open(q.to_s)).xpath('//div[@class="dimg"]/a/img/@src').each { |r|
32
- self.get path, r
33
- }
34
- }
35
- }
36
- }
37
- end
38
-
39
- def self.info_mi9
40
- { :from => true, :to => true }
41
- end
42
-
43
- end
44
- end
@@ -1,43 +0,0 @@
1
- #--
2
- # Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
3
- #
4
- # This file is part of Dumper.
5
- #
6
- # Dumper is free software: you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation, either version 3 of the License, or
9
- # (at your option) any later version.
10
- #
11
- # Dumper is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
- #
16
- # You should have received a copy of the GNU General Public License
17
- # along with Dumper. If not, see <http://www.gnu.org/licenses/>.
18
- #++
19
-
20
- module Dumper
21
- module Profiles
22
-
23
- def self.get_wallpaperhere(url, path, from = 1, to = 1)
24
- start = url[/\/page\/.+?\//].delete('/page/').to_i || 1
25
- url = url.sub /\/page\/.+?\//, '/page/$PAGE/'
26
- start.upto(to) { |page|
27
- u = url.gsub('$PAGE', page.to_s)
28
- Nokogiri::HTML(open(u)).xpath('//div[@class="wallpapers_list mt10 clearfix"]/ul[@class="clearfix"]/li').each { |p|
29
- p = p.xpath('a/@href').to_s
30
- size = Nokogiri::HTML(open('http://www.wallpaperhere.com' + p + '/download_preview')).xpath('//dl[@class="wp_rel"]/dd')[0].text
31
- Nokogiri::HTML(open('http://www.wallpaperhere.com' + p + '/download_' + size)).xpath('//div[@class="download_img"]/div/img/@src').each { |q|
32
- self.get path, 'http://www.wallpaperhere.com' + q.to_s
33
- }
34
- }
35
- }
36
- end
37
-
38
- def self.info_wallpaperhere
39
- { :from => false, :to => true }
40
- end
41
-
42
- end
43
- end