image-dumper 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/dumper +106 -0
- data/lib/dumper.rb +32 -0
- data/lib/dumper/dumper.rb +76 -0
- data/lib/dumper/profiles/4chan.rb +34 -0
- data/lib/dumper/profiles/behoimi.rb +39 -0
- data/lib/dumper/profiles/booru.rb +41 -0
- data/lib/dumper/profiles/deviantart.rb +34 -0
- data/lib/dumper/profiles/fakku.rb +49 -0
- data/lib/dumper/profiles/gelbooru.rb +41 -0
- data/lib/dumper/profiles/imagebam.rb +38 -0
- data/lib/dumper/profiles/mangaeden.rb +54 -0
- data/lib/dumper/profiles/mi9.rb +44 -0
- data/lib/dumper/profiles/multiplayer.rb +42 -0
- data/lib/dumper/profiles/redblow.rb +37 -0
- data/lib/dumper/profiles/sankakucomplex.rb +59 -0
- data/lib/dumper/profiles/wallpaperhere.rb +43 -0
- data/lib/dumper/utils.rb +36 -0
- data/lib/dumper/version.rb +24 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6b3b37cb3deb4ed73cd0cc3c676ecdaf45e690a
|
4
|
+
data.tar.gz: ff6a852744bbd7437321fc3bfa157164636d647e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9977d1fadaedc6834bac95d61a3c1e46f8b91e8d78d672c7de584332968ae1f8dfb11992b15bed2bbf23fbae87f54c8004f77ff166e95594272b66ca0064700e
|
7
|
+
data.tar.gz: b0b5874b6b1c6350f6c18d115d189b056ef83bba18ee53e8cd15a1cf3a34a3bec311bde5c8e256ea552e856c760aed3295513988238fc5cf799fb844399bee51
|
data/bin/dumper
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
|
4
|
+
#
|
5
|
+
# This file is part of Dumper.
|
6
|
+
#
|
7
|
+
# Dumper is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Dumper is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Dumper. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'dumper'
|
22
|
+
|
23
|
+
options = {}
|
24
|
+
|
25
|
+
OptionParser.new do |o|
|
26
|
+
options[:url] = []
|
27
|
+
options[:path] = []
|
28
|
+
options[:pages] = 1
|
29
|
+
|
30
|
+
o.on '-l', '--list', 'Show available profiles' do
|
31
|
+
abort 'Profiles available:'.tap { |s|
|
32
|
+
Dumper::Profiles::list.sort { |a, b| a <=> b }.each { |p| s << "\n" + (' ' * 3) + p }
|
33
|
+
} if ARGV.empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
o.on '-i', '--info PROFILE', 'Get info about profiles' do |profile|
|
37
|
+
if Dumper::Profiles::list.include? profile
|
38
|
+
method = ("info_#{profile}").to_sym
|
39
|
+
Dumper::Profiles::send(method).tap { |i|
|
40
|
+
puts "Option 'from' is #{i[:from] ? 'available' : 'not available'}"
|
41
|
+
puts "Option 'to' is #{i[:to] ? 'available' : 'not available'}"
|
42
|
+
}
|
43
|
+
else
|
44
|
+
puts 'Profile not found.'
|
45
|
+
end
|
46
|
+
abort
|
47
|
+
end
|
48
|
+
|
49
|
+
o.on '-u', '--url URL', 'Target URL' do |url|
|
50
|
+
options[:url] << url
|
51
|
+
end
|
52
|
+
|
53
|
+
o.on '-f', '--file FILE', 'File containing a list of URLs, a double pipe (||) and the target folder, one per line' do |file|
|
54
|
+
file = File.open(file).read.gsub(/\r\n?/, "\n")
|
55
|
+
file.each_line { |line|
|
56
|
+
split = line.split('||')
|
57
|
+
options[:url] << split[0].strip
|
58
|
+
options[:path] << split[1].strip
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
o.on '-p', '--path PATH', 'Target folder' do |path|
|
63
|
+
options[:path] << path
|
64
|
+
end
|
65
|
+
|
66
|
+
o.on '-x', '--xpath XPATH', 'Custom xpath' do |xpath|
|
67
|
+
options[:xpath] = xpath
|
68
|
+
end
|
69
|
+
|
70
|
+
o.on '-o', '--from PAGE', 'Start to save from... (if allowed)' do |pages|
|
71
|
+
options[:from] = pages.to_i
|
72
|
+
end
|
73
|
+
|
74
|
+
o.on '-g', '--to PAGE', 'Finish to save at... (if allowed)' do |pages|
|
75
|
+
options[:to] = pages.to_i
|
76
|
+
end
|
77
|
+
end.parse!
|
78
|
+
|
79
|
+
if options[:url].empty?
|
80
|
+
abort 'URL or list of URLs is required.'
|
81
|
+
elsif options[:path].empty?
|
82
|
+
abort 'Path is required.'
|
83
|
+
end
|
84
|
+
|
85
|
+
options[:url].each_with_index { |url, i|
|
86
|
+
begin
|
87
|
+
|
88
|
+
host = URI.parse(url).host.split(?.)[-2]
|
89
|
+
Dir.mkdir(options[:path][i]) unless File.directory? options[:path][i]
|
90
|
+
|
91
|
+
if Dumper::Profiles::list.include? host
|
92
|
+
method = ('get_' + host.gsub(?-, ?_)).to_sym
|
93
|
+
Dumper::Profiles::send method, url, options[:path][i], options[:from], options[:to]
|
94
|
+
else
|
95
|
+
Dumper::Profiles::get_generic url, options[:path][i], options[:xpath]
|
96
|
+
end
|
97
|
+
|
98
|
+
rescue Nokogiri::XML::XPath::SyntaxError => e
|
99
|
+
puts e.to_s.gsub(/expression/, 'xpath')
|
100
|
+
puts 'Cannot dump.'
|
101
|
+
rescue OpenURI::HTTPError => e
|
102
|
+
puts "Error opening #{url}: #{e}"
|
103
|
+
rescue URI::InvalidURIError => e
|
104
|
+
puts "URL #{url} is not valid: #{e}"
|
105
|
+
end
|
106
|
+
}
|
data/lib/dumper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of Dumper.
|
5
|
+
#
|
6
|
+
# Smogon-API 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
|
+
# Smogon-API 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 Smogon-API. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'open-uri'
|
21
|
+
require 'nokogiri'
|
22
|
+
require 'uri'
|
23
|
+
require 'optparse'
|
24
|
+
require 'net/http'
|
25
|
+
require 'base64'
|
26
|
+
|
27
|
+
Dir.glob(File.expand_path("../dumper/profiles/*.rb", __FILE__)).each { |f|
|
28
|
+
require "dumper/profiles/#{File.basename(f).split(?.)[0]}"
|
29
|
+
}
|
30
|
+
require 'dumper/dumper'
|
31
|
+
|
32
|
+
require 'dumper/version'
|
@@ -0,0 +1,76 @@
|
|
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; module Profiles
|
21
|
+
|
22
|
+
def self.list
|
23
|
+
Dir.glob(File.expand_path('../profiles/*.rb', __FILE__)).sort { |a, b| b <=> a }.map { |f|
|
24
|
+
f = File.basename(f).split(?.)[0]
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.get(path, p, ua = '', ref = '', filename = '')
|
29
|
+
p = p.to_s
|
30
|
+
|
31
|
+
begin
|
32
|
+
if p.start_with? 'data:image/'
|
33
|
+
filename = File.join path, filename == '' ? rand(1000).to_s + '.' + p.split('data:image/')[1].split(?;)[0] : filename
|
34
|
+
filename.gsub!(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
|
35
|
+
if File.exists? filename
|
36
|
+
puts "File #{filename} already exists."
|
37
|
+
else
|
38
|
+
puts "Downloading base64 image as #{filename}..."
|
39
|
+
p.gsub!(/data:image\/png;base64,/, '')
|
40
|
+
File.open(filename, 'wb') { |f| f.write Base64.decode64(p) }
|
41
|
+
end
|
42
|
+
else
|
43
|
+
filename = File.join path, filename == '' ? File.basename(p) : filename
|
44
|
+
filename.gsub!(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
|
45
|
+
if File.exists? filename
|
46
|
+
puts "File #{filename} already exists."
|
47
|
+
else
|
48
|
+
filename = File.join path, rand(1000).to_s + '.jpg' unless filename[-4] == ?.
|
49
|
+
puts "Downloading #{p} as #{filename}..."
|
50
|
+
File.open(filename, 'wb') { |f| f.write open(p, 'User-Agent' => ua, 'Referer' => ref).read }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
rescue Exception => e
|
54
|
+
p e
|
55
|
+
puts "Error downloading \#{p}."
|
56
|
+
return false
|
57
|
+
end
|
58
|
+
return true
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.get_generic(url, path, xpath)
|
62
|
+
uri = nil
|
63
|
+
Nokogiri::HTML(open(url)).xpath(xpath).each { |p|
|
64
|
+
if p.to_s.start_with? ?/
|
65
|
+
uri = URI(url) if uri.nil?
|
66
|
+
p = "#{uri.scheme}://#{uri.host}#{p}"
|
67
|
+
end
|
68
|
+
self.get path, p
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
def method_missing(method, *args, &block)
|
73
|
+
"'#{method.split('get_')[1]}' profile not found."
|
74
|
+
end
|
75
|
+
|
76
|
+
end; end
|
@@ -0,0 +1,34 @@
|
|
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_4chan(url, path, from = 1, to = 1)
|
24
|
+
Nokogiri::HTML(open(url)).xpath('//a[@class = "fileThumb"]/@href').each { |p|
|
25
|
+
self.get path, "http:#{p}"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.info_4chan
|
30
|
+
{ :from => false, :to => false }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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_behoimi(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
|
+
from.upto(to) { |page|
|
27
|
+
u = url + "&page=#{page}"
|
28
|
+
Nokogiri::HTML(open(u, 'User-Agent' => ua, 'Referer' => ref)).xpath('//img[@class="preview "]/@src').each { |p|
|
29
|
+
self.get path, p.to_s.gsub('preview/', ''), ua, ref
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.info_behoimi
|
35
|
+
{ :from => true, :to => true }
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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_booru(url, path, from = 1, to = 1)
|
24
|
+
page = 0
|
25
|
+
from.upto(to) { |i|
|
26
|
+
Nokogiri::HTML(open("#{url}&pid=#{page}")).xpath('//span[@class="thumb"]').each { |u|
|
27
|
+
self.get path, u.child.child['src'].gsub(/thumbs/, 'img').gsub(/thumbnails\//, 'images/').gsub(/thumbnail_/, '')
|
28
|
+
}
|
29
|
+
|
30
|
+
page += 20
|
31
|
+
puts "--- Page #{page} now... ---" # there are so much pages sometimes...
|
32
|
+
puts
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.info_booru
|
37
|
+
{ :from => true, :to => true }
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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_deviantart(url, path, from = 1, to = 1)
|
24
|
+
Nokogiri::HTML(open(url)).xpath('//div[@class="zones-container"]')[0].xpath('.//a[@class="thumb"]/@data-super-full-img').each { |u|
|
25
|
+
self.get path, u
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.info_deviantart
|
30
|
+
{ :from => false, :to => false }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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_fakku(url, path, from = 1, to = 999)
|
24
|
+
url += '/read' unless url.end_with? '/read'
|
25
|
+
errors = 0
|
26
|
+
|
27
|
+
cdn = open(url).read.split('window.params.thumbs')[1].split('\/thumbs\/')[0].gsub(/\\\//m, ?/)[5..-1] + '/images/'
|
28
|
+
|
29
|
+
from.upto(to) { |i|
|
30
|
+
return if errors == 10
|
31
|
+
|
32
|
+
file = "%03d.jpg" % i
|
33
|
+
filename = "#{cdn}#{file}"
|
34
|
+
|
35
|
+
unless self.get path, URI.parse(URI.encode(filename, "[]"))
|
36
|
+
errors += 1
|
37
|
+
|
38
|
+
file = File.join(path, file).gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
|
39
|
+
File.delete(file) if File.exists? file
|
40
|
+
end
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.info_fakku
|
45
|
+
{ :from => true, :to => true }
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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_gelbooru(url, path, from = 1, to = 1)
|
24
|
+
page = 0
|
25
|
+
from.upto(to) { |i|
|
26
|
+
Nokogiri::HTML(open("#{url}&pid=#{page}")).xpath('//span[@class="thumb"]').each { |u|
|
27
|
+
self.get path, u.child.child['src'].gsub(/thumbs/, 'images').gsub(/thumbnail_/, '')
|
28
|
+
}
|
29
|
+
|
30
|
+
page += 63
|
31
|
+
puts "--- Page #{page} now... ---" # there are so much pages sometimes...
|
32
|
+
puts
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.info_gelbooru
|
37
|
+
{ :from => true, :to => true }
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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_imagebam(url, path, from = 1, to = 1)
|
24
|
+
Nokogiri::HTML(open(url)).xpath('//a[@style="border:none; margin:2px;"]/@href').each { |p|
|
25
|
+
next unless p.to_s.start_with? 'http://www.imagebam.com/image/'
|
26
|
+
|
27
|
+
Nokogiri::HTML(open(p)).xpath('//img[@onclick="scale(this);"]/@src').each { |u|
|
28
|
+
self.get path, u
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.info_imagebam
|
34
|
+
{ :from => false, :to => false }
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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_mangaeden(url, path, from = 1, to = 1)
|
24
|
+
Nokogiri::HTML(open(url)).xpath('//a[@class="chapterLink"]').each { |p|
|
25
|
+
i = 1
|
26
|
+
|
27
|
+
dir = File.join path, "#{p.children[1].text} - #{p.children[3].text.sanitize_filename}"
|
28
|
+
Dir.mkdir(dir) unless File.directory? dir
|
29
|
+
|
30
|
+
page = Nokogiri::HTML(open("http://www.mangaeden.com#{p['href']}"))
|
31
|
+
|
32
|
+
page.xpath('//img[@id="mainImg"]/@src').each { |r|
|
33
|
+
self.get dir, r, '', '', "1.png"
|
34
|
+
i += 1
|
35
|
+
}
|
36
|
+
|
37
|
+
page.xpath('//a[@class="ui-state-default"]').each { |q|
|
38
|
+
next unless q.text.numeric?
|
39
|
+
q = q['href']
|
40
|
+
|
41
|
+
Nokogiri::HTML(open("http://www.mangaeden.com#{q}")).xpath('//img[@id="mainImg"]/@src').each { |r|
|
42
|
+
self.get dir, r, '', '', "#{i}.png"
|
43
|
+
i += 1
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.info_mangaeden
|
50
|
+
{ :from => false, :to => false }
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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
|
@@ -0,0 +1,42 @@
|
|
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
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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
|
37
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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
|
59
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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
|
data/lib/dumper/utils.rb
ADDED
@@ -0,0 +1,36 @@
|
|
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
|
+
class String
|
21
|
+
|
22
|
+
def numeric?
|
23
|
+
self.to_i.to_s == self || self.to_f.to_s == self
|
24
|
+
end
|
25
|
+
|
26
|
+
def sanitize_filename
|
27
|
+
self.split(/(?<=.)\.(?=[^.])(?!.*\.[^.])/m).map { |s| s.gsub /[^a-z0-9\-]+/i, ?_ }.join(?.)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class NilClass
|
33
|
+
def numeric?
|
34
|
+
false
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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
|
+
def self.version
|
22
|
+
'0.5'
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: image-dumper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.5'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Giovanni Capuano
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: A dumper to download whole galleries from board like 4chan, imagebam,
|
28
|
+
mangaeden, deviantart, etc.
|
29
|
+
email: webmaster@giovannicapuano.net
|
30
|
+
executables:
|
31
|
+
- dumper
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- lib/dumper/dumper.rb
|
36
|
+
- lib/dumper/profiles/4chan.rb
|
37
|
+
- lib/dumper/profiles/behoimi.rb
|
38
|
+
- lib/dumper/profiles/booru.rb
|
39
|
+
- lib/dumper/profiles/deviantart.rb
|
40
|
+
- lib/dumper/profiles/fakku.rb
|
41
|
+
- lib/dumper/profiles/gelbooru.rb
|
42
|
+
- lib/dumper/profiles/imagebam.rb
|
43
|
+
- lib/dumper/profiles/mangaeden.rb
|
44
|
+
- lib/dumper/profiles/mi9.rb
|
45
|
+
- lib/dumper/profiles/multiplayer.rb
|
46
|
+
- lib/dumper/profiles/redblow.rb
|
47
|
+
- lib/dumper/profiles/sankakucomplex.rb
|
48
|
+
- lib/dumper/profiles/wallpaperhere.rb
|
49
|
+
- lib/dumper/utils.rb
|
50
|
+
- lib/dumper/version.rb
|
51
|
+
- lib/dumper.rb
|
52
|
+
- bin/dumper
|
53
|
+
homepage: http://www.giovannicapuano.net
|
54
|
+
licenses:
|
55
|
+
- GPL-3
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.0.3
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Fetch and download image gallery.
|
77
|
+
test_files: []
|