Sha256: 0c9d1ff7023dcc842b6bfaf3c59a9a01c16a40acb7d8c58d5e4d5396bec173fc

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 KB

Contents

= ero_getter

ero_getter is downloader for ero gazou.

== usage
 EroGetter.download(url)

automaticaly download in $HOME/ero_getter/#{site}/#{sub_directory}/

== support other sites

add lib/downloader/#{site_name}.rb

 class #{SiteName} < EroGetter::Base
    name 'Site Name'
    url %r{http://example.com/archives/(\d+).html}
    target "a > img" do |path|                 # use css selector
      path.parent[:href] =~ /jpe?g|gif|png/    # filter like Array.select
    end
    sub_directory do
      url.match(/(\d+)\.html/)[1]
    end
    filename {|attr| "%04d%s" % [attr[:index], attr[:ext]] }  # if you want sequencial filename
 end

make directory spec/samples/#{site_name}
and download sample of html source in spec/sample/#{site_name}/sample.html

add spec/downloader#{site_name}_spec.rb

 require 'spec_helper'
 describe #{SiteName} do
   subject { @dl }
   let(:url) { 'http://example.com/archives/01010101.html' }
   before do
     EroGetter.stub(:mkdir)
     @dl = #{SiteName}.new(url)
     fake(:get, url, '#{site_name}/sample.html')
   end
   its(:sub_directory) { should == '01010101' }
   its("targets.count") { should == #{numbers of image} } 
 end

then pull request!

== see also
http://github.com/masarakki/ero_getter_server

== Contributing to ero_getter

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2012 masarakki. See LICENSE.txt for
further details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ero_getter-1.3.1 README.rdoc