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
@@ -1,42 +1,56 @@
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_multiplayer(url, path, from = 1, to = 1)
24
- url += '?pagina=1' unless url.split(??).last.start_with? 'pagina'
25
-
26
- from.upto(to) { |i|
27
- Nokogiri::HTML(open(url + i.to_s)).xpath('//div[@class="thumb"]/a/@href').each { |p|
28
- next unless p.to_s.start_with? '/immagini/'
29
-
30
- Nokogiri::HTML(open("http://multiplayer.it#{p}")).xpath('//a[@class="button"]/@href').each { |u|
31
- self.get path, u
32
- }
33
- }
34
- }
35
- end
36
-
37
- def self.info_multiplayer
38
- { :from => true, :to => true }
39
- end
40
-
41
- end
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
+ class Multiplayer < Profile
24
+ def dump(url, path, from, to)
25
+ from -= 1
26
+ to -= 1 if to >= 1
27
+
28
+ url.gsub! /\/giochi\//, '/immagini/galleria/'
29
+ url.gsub! '.html', ''
30
+ gallery = JSON.parse open("#{url}?from=#{from}").read
31
+
32
+ to -= from if to >= 1
33
+
34
+ gallery['objects'].reverse[0..to].each { |image|
35
+ @pool.process {
36
+ Dumper::Profiles.get path, image['image']
37
+ }
38
+ }
39
+ end
40
+ end
41
+
42
+ class << self
43
+ def get_multiplayer(url, path, from = 1, to = -1)
44
+ Multiplayer.new { |p|
45
+ p.dump url, path, from, to
46
+ p.shutdown
47
+ }
48
+ end
49
+
50
+ def info_multiplayer
51
+ { from: :enabled, to: :enabled, type: :images }
52
+ end
53
+ end
54
+
55
+ end
42
56
  end
@@ -1,37 +1,50 @@
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_redblow(url, path, from = 1, to = 1)
24
- ua = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0'
25
- ref = url
26
-
27
- Nokogiri::HTML(open(url)).xpath('//img[@class="attachment-medium"]/@src').each { |p|
28
- self.get path, p, ua, ref
29
- }
30
- end
31
-
32
- def self.info_redblow
33
- { :from => false, :to => false }
34
- end
35
-
36
- end
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
+ class RedBlow < Profile
24
+ def dump(url, path, from, to)
25
+ from -= 1
26
+ to -= 1 if to >= 1
27
+
28
+ Nokogiri::HTML(open(url)).xpath('//img[@class="attachment-medium"]/@src')[from..to].each { |p|
29
+ @pool.process {
30
+ Dumper::Profiles.get path, p, { referer: url }
31
+ }
32
+ }
33
+ end
34
+ end
35
+
36
+ class << self
37
+ def get_redblow(url, path, from = 1, to = -1)
38
+ RedBlow.new { |p|
39
+ p.dump url, path, from, to
40
+ p.shutdown
41
+ }
42
+ end
43
+
44
+ def info_redblow
45
+ { from: :enabled, to: :enabled, type: :images }
46
+ end
47
+ end
48
+
49
+ end
37
50
  end
@@ -1,59 +1,82 @@
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
- ### ALMOST BROKEN ###
24
- def self.get_sankakucomplex(url, path, from = 1, to = 1)
25
- if url.include?('idol.sankakucomplex') || url.include?('chan.sankakucomplex')
26
- url.gsub!('index', 'index.content')
27
- from.upto(to) { |page|
28
- u = url + "&page=#{page}"
29
- op = open(u)
30
- begin
31
- Nokogiri::HTML(open(u)).xpath('//a/@href').each { |p|
32
- p = url.gsub(/post(.+)/, p.to_s)
33
- begin
34
- Nokogiri::HTML(open(p)).xpath('//a[@id="image-link"]/img/@src').each { |q|
35
- self.get path, q
36
- }
37
- rescue Exception => e
38
- sleep 1
39
- retry
40
- end
41
- }
42
- rescue Exception => e
43
- sleep 1
44
- retry
45
- end
46
- }
47
- else
48
- Nokogiri::HTML(open(url)).xpath('//a[@class="highslide"]/@href').each { |p|
49
- self.get path, p
50
- }
51
- end
52
- end
53
-
54
- def self.info_sankakucomplex
55
- { :from => true, :to => true }
56
- end
57
-
58
- end
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
+ class SankakuComplex < Profile
24
+ def dump(url, path, from, to)
25
+ if url.include?('idol.sankakucomplex') || url.include?('chan.sankakucomplex')
26
+ to = 1 if to == -1
27
+ prefix = url.include?('idol.sankakucomplex') ? 'idol' : 'chan'
28
+
29
+ from.upto(to) { |page|
30
+ u = url + "&page=#{page}"
31
+ begin
32
+ op = open u
33
+ rescue Exception => e
34
+ sleep 1
35
+ retry
36
+ end
37
+
38
+ Nokogiri::HTML(op).xpath('//a/@href').each { |p|
39
+ next unless p.to_s.start_with? '/post/show'
40
+
41
+ @pool.process {
42
+ begin
43
+ img = Nokogiri::HTML(open("http://#{prefix}.sankakucomplex.com/#{p}")).at_xpath('//a[@itemprop="contentUrl"]/@href').to_s
44
+ Dumper::Profiles.get path, img, { referer: u }
45
+ rescue Exception => e
46
+ retry
47
+ end
48
+ }
49
+ }
50
+ }
51
+ else
52
+ from -= 1
53
+ to -= 1 if to >= 1
54
+
55
+ [].tap { |urls|
56
+ Nokogiri::HTML(open(url)).xpath('//a[@target="_blank"]/@href').each { |u|
57
+ urls << u if u.to_s.start_with? 'http://images.sankakucomplex.com/wp-content/'
58
+ }
59
+ }[from..to].each { |p|
60
+ @pool.process {
61
+ Dumper::Profiles.get path, p, { referer: url }
62
+ }
63
+ }
64
+ end
65
+ end
66
+ end
67
+
68
+ class << self
69
+ def get_sankakucomplex(url, path, from = 1, to = -1)
70
+ SankakuComplex.new { |p|
71
+ p.dump url, path, from, to
72
+ p.shutdown
73
+ }
74
+ end
75
+
76
+ def info_sankakucomplex
77
+ { from: :enabled, to: :enabled, type: :images }
78
+ end
79
+ end
80
+
81
+ end
59
82
  end
@@ -1,35 +1,55 @@
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_teca(url, path)
24
- url = url.split('index').first
25
- Nokogiri::HTML(open(url)).xpath('//a/@href').each { |p|
26
- self.get(path, "#{url}/#{p}") if p.to_s =~ /.\.(png|bmp|jpeg|jpg|gif|tiff)$/i
27
- }
28
- end
29
-
30
- def self.info_teca
31
- { :from => false, :to => false }
32
- end
33
-
34
- end
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
+ class Teca < Profile
24
+ def dump(url, path, from, to)
25
+ from -= 1
26
+ to -= 1 if to >= 1
27
+ url = url.split('index').first
28
+
29
+ [].tap { |urls|
30
+ Nokogiri::HTML(open(url)).xpath('//a/@href').each { |u|
31
+ urls << u if u.to_s =~ /.\.(png|bmp|jpeg|jpg|gif|tiff)$/i
32
+ }
33
+ }.reverse[from..to].each { |p|
34
+ @pool.process {
35
+ Dumper::Profiles.get path, "#{url}/#{p}"
36
+ }
37
+ }
38
+ end
39
+ end
40
+
41
+ class << self
42
+ def get_teca(url, path, from = 1, to = -1)
43
+ Teca.new { |p|
44
+ p.dump url, path, from, to
45
+ p.shutdown
46
+ }
47
+ end
48
+
49
+ def info_teca
50
+ { from: :enabled, to: :enabled, type: :images }
51
+ end
52
+ end
53
+
54
+ end
35
55
  end
@@ -1,43 +1,52 @@
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_yande(url, path, from = 1, to = 1)
24
- ua = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0'
25
- ref = url
26
-
27
- from.upto(to) { |i|
28
- Nokogiri::HTML(open("#{url}&page=#{i}", 'User-Agent' => ua, 'Referer' => ref)).xpath('//a[@class="thumb"]/@href').each { |p|
29
- img = Nokogiri::HTML(open("https://yande.re#{p}", 'User-Agent' => ua, 'Referer' => ref)).at_xpath('//img[@id="image"]/@src').text
30
- self.get path, img, ua, ref
31
- }
32
-
33
- puts "--- Page #{i} now... ---" # there are so much pages sometimes...
34
- puts
35
- }
36
- end
37
-
38
- def self.info_yande
39
- { :from => true, :to => true }
40
- end
41
-
42
- end
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
+ class YandeRe < Profile
24
+ def dump(url, path, from, to)
25
+ from.upto(to) { |i|
26
+ puts "--- Page #{i} ---" if Dumper::Profiles.verbose?
27
+
28
+ Nokogiri::HTML(open("#{url}&page=#{i}", 'User-Agent' => Dumper::Profiles::USER_AGENT, 'Referer' => url)).xpath('//a[@class="thumb"]/@href').each { |p|
29
+ @pool.process {
30
+ img = Nokogiri::HTML(open("https://yande.re#{p}", 'User-Agent' => Dumper::Profiles::USER_AGENT, 'Referer' => url)).at_xpath('//img[@id="image"]/@src').text
31
+ Dumper::Profiles.get path, img, { referer: url }
32
+ }
33
+ }
34
+ }
35
+ end
36
+ end
37
+
38
+ class << self
39
+ def get_yande(url, path, from = 1, to = 1)
40
+ YandeRe.new { |p|
41
+ p.dump url, path, from, to
42
+ p.shutdown
43
+ }
44
+ end
45
+
46
+ def info_yande
47
+ { from: :enabled, to: :enabled, type: :pages }
48
+ end
49
+ end
50
+
51
+ end
43
52
  end