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, HashPage, HtmlPage, Infoseek, JsonPage, JsonString, Mamba, NoTokenError, NodeNotFound, OAuthClient, OAuthError, Page, PickError, Scout, ScoutSquad, ScrapeError, StateError, Storage, TargetError, VK, XmlPage, Yandex, Youtube, ZippingError
Constant Summary collapse
- L =
RMTools::RMLogger.new(config.logger || {})
- VERSION =
'1.3.3'
- 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
-
#ReloadablePage(&reload_condition) ⇒ Object
using reprocessing of page in case of non-200 response: page_class = ReloadablePage do @res and @res.code != 200 end.
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
585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'lib/rhack/page.rb', line 585 def ReloadablePage(&reload_condition) Class.new Page do 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 end end |