image-dumper 0.5.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dumper +47 -40
- data/lib/dumper.rb +38 -36
- data/lib/dumper/dumper.rb +114 -52
- data/lib/dumper/profiles/4chan.rb +49 -33
- data/lib/dumper/profiles/behoimi.rb +48 -38
- data/lib/dumper/profiles/booru.rb +54 -40
- data/lib/dumper/profiles/deviantart.rb +49 -33
- data/lib/dumper/profiles/fakku.rb +61 -51
- data/lib/dumper/profiles/fc2.rb +49 -33
- data/lib/dumper/profiles/gelbooru.rb +54 -40
- data/lib/dumper/profiles/imagebam.rb +55 -37
- data/lib/dumper/profiles/mangaeden.rb +69 -53
- data/lib/dumper/profiles/mangago.rb +53 -40
- data/lib/dumper/profiles/mangahere.rb +68 -49
- data/lib/dumper/profiles/multiplayer.rb +55 -41
- data/lib/dumper/profiles/redblow.rb +49 -36
- data/lib/dumper/profiles/sankakucomplex.rb +81 -58
- data/lib/dumper/profiles/teca.rb +54 -34
- data/lib/dumper/profiles/yande.rb +51 -42
- data/lib/dumper/utils.rb +40 -42
- data/lib/dumper/version.rb +23 -23
- data/spec/4chan_spec.rb +28 -0
- data/spec/behoimi_spec.rb +28 -0
- data/spec/booru_spec.rb +28 -0
- data/spec/deviantart_spec.rb +28 -0
- data/spec/fakku_spec.rb +28 -0
- data/spec/fc2_spec.rb +28 -0
- data/spec/gelbooru_spec.rb +28 -0
- data/spec/imagebam_spec.rb +28 -0
- data/spec/mangaeden_spec.rb +28 -0
- data/spec/mangago_spec.rb +28 -0
- data/spec/mangahere_spec.rb +28 -0
- data/spec/multiplayer_spec.rb +28 -0
- data/spec/redblow_spec.rb +28 -0
- data/spec/sankakucomplex_spec.rb +41 -0
- data/spec/teca_spec.rb +28 -0
- data/spec/yande_spec.rb +28 -0
- metadata +119 -6
- data/lib/dumper/profiles/i_doujin.rb +0 -38
- data/lib/dumper/profiles/mi9.rb +0 -44
- data/lib/dumper/profiles/wallpaperhere.rb +0 -43
data/lib/dumper/utils.rb
CHANGED
@@ -1,43 +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
|
-
class String
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
[a.scheme, a.userinfo, a.host, a.port, nil, a.path, nil, a.query, a.fragment]
|
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
|
+
class String
|
21
|
+
def numeric?
|
22
|
+
self.to_i.to_s == self || self.to_f.to_s == self
|
23
|
+
end
|
24
|
+
|
25
|
+
def sanitize_filename
|
26
|
+
self.split(/(?<=.)\.(?=[^.])(?!.*\.[^.])/m).map { |s| s.gsub /[^a-z0-9\-]+/i, ?_ }.join(?.)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class NilClass
|
31
|
+
def numeric?
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class URI::Parser
|
37
|
+
def split url
|
38
|
+
a = Addressable::URI::parse url
|
39
|
+
[a.scheme, a.userinfo, a.host, a.port, nil, a.path, nil, a.query, a.fragment]
|
40
|
+
end
|
43
41
|
end
|
data/lib/dumper/version.rb
CHANGED
@@ -1,24 +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.
|
23
|
-
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
|
+
def self.version
|
22
|
+
'0.6'
|
23
|
+
end
|
24
24
|
end
|
data/spec/4chan_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_4chan'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a thread from 4chan' do
|
17
|
+
url = 'https://boards.4chan.org/e/res/1436774'
|
18
|
+
Dumper::Profiles.get_4chan url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be 1
|
22
|
+
|
23
|
+
image = FastImage.size images.last
|
24
|
+
expect(image).to be_kind_of(Array)
|
25
|
+
|
26
|
+
expect(image.first).to be >= 1
|
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_behoimi'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a thread from behoimi' do
|
17
|
+
url = 'http://behoimi.org/post/index?tags=kaeru'
|
18
|
+
Dumper::Profiles.get_behoimi url, @dir
|
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 800
|
27
|
+
end
|
28
|
+
end
|
data/spec/booru_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_booru'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a page from *booru' do
|
17
|
+
url = 'http://safebooru.org/index.php?page=post&s=list&tags=crying'
|
18
|
+
Dumper::Profiles.get_booru url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be >= 27
|
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
|
@@ -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_deviantart'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a gallery from deviantart' do
|
17
|
+
url = 'http://targete.deviantart.com/gallery/?offset=72'
|
18
|
+
Dumper::Profiles.get_deviantart url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be >= 20
|
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
|
data/spec/fakku_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_fakku'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a manga from fakku' do
|
17
|
+
url = 'http://www.fakku.net/doujinshi/connected-feelings-english'
|
18
|
+
Dumper::Profiles.get_fakku url, @dir, 1, 5
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be 5
|
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
|
data/spec/fc2_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_fc2'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a gallery from *fc2' do
|
17
|
+
url = 'http://moeimg.blog133.fc2.com/blog-entry-5004.html'
|
18
|
+
Dumper::Profiles.get_fc2 url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be 53
|
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
|
@@ -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_gelbooru'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a gallery from gelbooru' do
|
17
|
+
url = 'http://gelbooru.com/index.php?page=post&s=list&tags=bath'
|
18
|
+
Dumper::Profiles.get_gelbooru url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be >= 56
|
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
|
@@ -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_imagebam'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a gallery from imagebam' do
|
17
|
+
url = 'http://www.imagebam.com/gallery/ab4f428e9eec0c70bc53b27cfb91d902/'
|
18
|
+
Dumper::Profiles.get_imagebam url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be >= 94
|
22
|
+
|
23
|
+
image = FastImage.size images.last
|
24
|
+
expect(image).to be_kind_of(Array)
|
25
|
+
|
26
|
+
expect(image.first).to be 511
|
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_mangaeden'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a manga from mangaeden' do
|
17
|
+
url = 'http://www.mangaeden.com/en-manga/nisekoi'
|
18
|
+
Dumper::Profiles.get_mangaeden url, @dir, 1, 2
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*_Question/*"]
|
21
|
+
expect(images.length).to be 24
|
22
|
+
|
23
|
+
image = FastImage.size images.first
|
24
|
+
expect(image).to be_kind_of(Array)
|
25
|
+
|
26
|
+
expect(image.first).to be 899
|
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_mangago'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a manga from mangago' do
|
17
|
+
url = 'http://www.mangago.com/read-manga/ore_no_imouto_ga_konna_ni_kawaii_wake_ga_nai_my_angel_ayase_is_so_cute_doujinshi/bt/71284/Ch1/'
|
18
|
+
Dumper::Profiles.get_mangago url, @dir
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*"]
|
21
|
+
expect(images.length).to be 21
|
22
|
+
|
23
|
+
image = FastImage.size images.last
|
24
|
+
expect(image).to be_kind_of(Array)
|
25
|
+
|
26
|
+
expect(image.last).to be 1300
|
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_mangahere'
|
9
|
+
Dir.mkdir @dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
FileUtils.rm_r @dir
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dumps a manga from mangahere' do
|
17
|
+
url = 'http://www.mangahere.com/manga/love_all/'
|
18
|
+
Dumper::Profiles.get_mangahere url, @dir, 1, 2
|
19
|
+
|
20
|
+
images = Dir["#{@dir}/*_2/*"]
|
21
|
+
expect(images.length).to be 41
|
22
|
+
|
23
|
+
image = FastImage.size images.last
|
24
|
+
expect(image).to be_kind_of(Array)
|
25
|
+
|
26
|
+
expect(image.first).to be 730
|
27
|
+
end
|
28
|
+
end
|