ero_getter 1.3.9 → 1.4.0
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.
- data/VERSION +1 -1
- data/ero_getter.gemspec +3 -1
- data/lib/downloader/shimo_soku.rb +3 -17
- data/lib/downloader/wakuteka_sokuhou.rb +2 -12
- data/lib/ero_getter/livedoor.rb +22 -0
- data/lib/ero_getter.rb +1 -0
- data/spec/ero_getter/livedoor_spec.rb +18 -0
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/ero_getter.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ero_getter"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["masarakki"]
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/downloader/wakuteka_sokuhou.rb",
|
38
38
|
"lib/ero_getter.rb",
|
39
39
|
"lib/ero_getter/base.rb",
|
40
|
+
"lib/ero_getter/livedoor.rb",
|
40
41
|
"spec/downloader/elog_bakufu_spec.rb",
|
41
42
|
"spec/downloader/gazou_sokuhou_spec.rb",
|
42
43
|
"spec/downloader/mink_channel_spec.rb",
|
@@ -45,6 +46,7 @@ Gem::Specification.new do |s|
|
|
45
46
|
"spec/downloader/shimo_soku_spec.rb",
|
46
47
|
"spec/downloader/wakuteka_sokuhou_spec.rb",
|
47
48
|
"spec/ero_getter/base_spec.rb",
|
49
|
+
"spec/ero_getter/livedoor_spec.rb",
|
48
50
|
"spec/ero_getter_spec.rb",
|
49
51
|
"spec/samples/elog_bakufu/sample.html",
|
50
52
|
"spec/samples/gazou_sokuhou/sample.html",
|
@@ -1,20 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
class ShimoSoku < EroGetter::Base
|
3
|
-
name '下速'
|
4
|
-
url %r{http://blog.livedoor.jp/pramo/archives/\d+.html}
|
5
|
-
|
6
|
-
target "img.pict" do |path|
|
7
|
-
if path.parent.name == "a" && path.parent[:href] =~ /jpe?g|gif|png$/
|
8
|
-
path.parent[:href]
|
9
|
-
else
|
10
|
-
path[:src]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
sub_directory do
|
15
|
-
url.match(/(\d+).html/)[1]
|
16
|
-
end
|
17
|
-
|
18
|
-
filename { |attr| "%04d%s" % [attr[:index], attr[:ext]] }
|
19
2
|
|
3
|
+
class ShimoSoku < EroGetter::Livedoor
|
4
|
+
name '下速'
|
5
|
+
blog_id 'pramo'
|
20
6
|
end
|
@@ -1,17 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
class WakutekaSokuhou < EroGetter::
|
2
|
+
class WakutekaSokuhou < EroGetter::Livedoor
|
3
3
|
|
4
4
|
name 'わくてか速報'
|
5
|
-
|
6
|
-
|
7
|
-
target ".article-body-inner a > img" do |path|
|
8
|
-
path.parent[:href] if path.parent[:href] =~ /jpe?g|gif|png$/
|
9
|
-
end
|
10
|
-
|
11
|
-
sub_directory do
|
12
|
-
url.match(/(\d+)\.html/)[1]
|
13
|
-
end
|
14
|
-
|
15
|
-
filename {|attr| "%04d%s" % [attr[:index], attr[:ext]] }
|
5
|
+
blog_id 'wakusoku'
|
16
6
|
|
17
7
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class EroGetter::Livedoor < EroGetter::Base
|
2
|
+
class << self
|
3
|
+
def blog_id(id)
|
4
|
+
self.url Regexp.new("http://blog.livedoor.jp/#{id}/archives/\\d+.html")
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
target "img.pict" do |path|
|
9
|
+
if path.parent.name == "a" && path.parent[:href] =~ /jpe?g|gif|png$/
|
10
|
+
path.parent[:href]
|
11
|
+
else
|
12
|
+
path[:src]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
sub_directory do
|
17
|
+
url.match(/(\d+).html/)[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
filename { |attr| "%04d%s" % [attr[:index], attr[:ext]] }
|
21
|
+
end
|
22
|
+
|
data/lib/ero_getter.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe EroGetter::Livedoor do
|
5
|
+
subject { @klass }
|
6
|
+
before do
|
7
|
+
@klass = Class.new(EroGetter::Livedoor) do
|
8
|
+
name 'てすと'
|
9
|
+
blog_id 'hoge'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
it { subject.instance_methods.should include :url_regex }
|
13
|
+
it do
|
14
|
+
lambda {
|
15
|
+
subject.new('http://blog.livedoor.jp/hoge/archives/101010.html')
|
16
|
+
}.should_not raise_error
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ero_getter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- lib/downloader/wakuteka_sokuhou.rb
|
200
200
|
- lib/ero_getter.rb
|
201
201
|
- lib/ero_getter/base.rb
|
202
|
+
- lib/ero_getter/livedoor.rb
|
202
203
|
- spec/downloader/elog_bakufu_spec.rb
|
203
204
|
- spec/downloader/gazou_sokuhou_spec.rb
|
204
205
|
- spec/downloader/mink_channel_spec.rb
|
@@ -207,6 +208,7 @@ files:
|
|
207
208
|
- spec/downloader/shimo_soku_spec.rb
|
208
209
|
- spec/downloader/wakuteka_sokuhou_spec.rb
|
209
210
|
- spec/ero_getter/base_spec.rb
|
211
|
+
- spec/ero_getter/livedoor_spec.rb
|
210
212
|
- spec/ero_getter_spec.rb
|
211
213
|
- spec/samples/elog_bakufu/sample.html
|
212
214
|
- spec/samples/gazou_sokuhou/sample.html
|
@@ -235,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
237
|
version: '0'
|
236
238
|
segments:
|
237
239
|
- 0
|
238
|
-
hash:
|
240
|
+
hash: 1975741745447522419
|
239
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
242
|
none: false
|
241
243
|
requirements:
|