Module: RHACK

Defined in:
lib/rhack/clients/base.rb,
lib/rhack.rb,
lib/rhack/dl.rb,
lib/rhack/page.rb,
lib/rhack/frame.rb,
lib/rhack/scout.rb,
lib/rhack/cookie.rb,
lib/rhack/clients.rb,
lib/rhack/storage.rb,
lib/rhack/version.rb,
lib/rhack/scout_squad.rb,
lib/rhack/clients/oauth.rb,
lib/rhack/proxy/checker.rb,
lib/rhack/clients/storage.rb,
lib/rhack/clients/examples.rb,
lib/rhack/clients/compatibility.rb

Overview

TODO 1.0+: опция для клиента, чтобы это описание имело смысл, т.к. сейчас это ложь:

Defined Under Namespace

Modules: Downloaders, Proxy Classes: Client, ClientError, CodeIndiffirentPage, ConfigError, Cookie, Frame, Google, Infoseek, JsonString, Mamba, NoTokenError, NodeNotFound, OAuthClient, OAuthError, Page, PickError, Scout, ScoutSquad, ScrapeError, StateError, Storage, TargetError, VK, Yandex, Youtube, ZippingError

Constant Summary collapse

L =
RMTools::RMLogger.new(config.logger || {})
VERSION =
'1.1.8'
Service =
Client
ServiceError =
ClientError
@@config =
cfgfile ? YAML.load(IO.read(cfgfile)) : {}
@@redis =
nil
@@useragents =
['Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1']

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dl(uri, df = File.basename(uri.parse(:uri).path), threads = 5, timeout = 600, &block) ⇒ Object



303
304
305
306
# File 'lib/rhack/dl.rb', line 303

def dl(uri, df=File.basename(uri.parse(:uri).path), threads=5, timeout=600, &block)
  Curl.run
  Frame({:timeout=>timeout}, threads).dl(uri, df, :auto, threads, &block)
end

Instance Method Details

#ReloadablePage(&reload_condition) ⇒ Object

using reprocessing of page in case of non-200 response: page_class = ReloadablePage do

@res and @res.code != 200

end



425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/rhack/page.rb', line 425

def ReloadablePage(&reload_condition)
  rp = Class.new Page
  rp.send :define_method, :process do |curl, opts|
    super(curl, opts || {})
    if curl.instance_eval &reload_condition
      curl.retry!
      nil # in case of reload_condition.call super's callback will not proceed
    else self
    end
  end
  rp
end