ero_getter 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +45 -0
- data/VERSION +1 -1
- data/ero_getter.gemspec +1 -1
- data/lib/ero_getter/base.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,5 +1,50 @@
|
|
1
1
|
= ero_getter
|
2
2
|
|
3
|
+
ero_getter is downloader for ero gazou.
|
4
|
+
|
5
|
+
== usage
|
6
|
+
EroGetter.download(url)
|
7
|
+
|
8
|
+
automaticaly download in $HOME/ero_getter/#{site}/#{sub_directory}/
|
9
|
+
|
10
|
+
== support other sites
|
11
|
+
|
12
|
+
add lib/downloader/#{site_name}.rb
|
13
|
+
|
14
|
+
class #{SiteName} < EroGetter::Base
|
15
|
+
name 'Site Name'
|
16
|
+
url %r{http://example.com/archives/(\d+).html}
|
17
|
+
target "a > img" do |path| # use css selector
|
18
|
+
path.parent[:href] =~ /jpe?g|gif|png/ # filter like Array.select
|
19
|
+
end
|
20
|
+
sub_directory do
|
21
|
+
url.match(/(\d+)\.html/)[1]
|
22
|
+
end
|
23
|
+
filename {|attr| "%04d%s" % [attr[:index], attr[:ext]] } # if you want sequencial filename
|
24
|
+
end
|
25
|
+
|
26
|
+
make directory spec/samples/#{site_name}
|
27
|
+
and download sample of html source in spec/sample/#{site_name}/sample.html
|
28
|
+
|
29
|
+
add spec/downloader#{site_name}_spec.rb
|
30
|
+
|
31
|
+
require 'spec_helper'
|
32
|
+
describe #{SiteName} do
|
33
|
+
subject { @dl }
|
34
|
+
let(:url) { 'http://example.com/archives/01010101.html' }
|
35
|
+
before do
|
36
|
+
EroGetter.stub(:mkdir)
|
37
|
+
@dl = #{SiteName}.new(url)
|
38
|
+
fake(:get, url, '#{site_name}/sample.html')
|
39
|
+
end
|
40
|
+
its(:sub_directory) { should == '01010101' }
|
41
|
+
its("targets.count") { should == #{numbers of image} }
|
42
|
+
end
|
43
|
+
|
44
|
+
then pull request!
|
45
|
+
|
46
|
+
== see also
|
47
|
+
http://github.com/masarakki/ero_getter_server
|
3
48
|
|
4
49
|
== Contributing to ero_getter
|
5
50
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.1
|
data/ero_getter.gemspec
CHANGED
data/lib/ero_getter/base.rb
CHANGED
@@ -154,7 +154,7 @@ class EroGetter::Base
|
|
154
154
|
|
155
155
|
def filename(basename, index)
|
156
156
|
if respond_to?(:_filename)
|
157
|
-
_filename(index
|
157
|
+
_filename(:index => index, :basename => basename, :ext => File.extname(basename))
|
158
158
|
else
|
159
159
|
basename
|
160
160
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -211,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
211
|
version: '0'
|
212
212
|
segments:
|
213
213
|
- 0
|
214
|
-
hash:
|
214
|
+
hash: 2588041468797638508
|
215
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
216
|
none: false
|
217
217
|
requirements:
|