Module: RHACK
- Defined in:
- lib/rhack/services/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/version.rb,
lib/rhack/services.rb,
lib/rhack/scout_squad.rb,
lib/rhack/proxy/checker.rb,
lib/rhack/services/examples.rb,
lib/rhack/services/compatibility.rb
Overview
TODO 1.0+: опция для клиента, чтобы это описание имело смысл, т.к. сейчас это ложь:
Defined Under Namespace
Modules: Downloaders, Proxy Classes: Client, ClientError, ConfigError, Cookie, Frame, Google, Infoseek, Mamba, Page, PickError, Scout, ScoutSquad, TargetError, VK, Yandex, Youtube, ZippingError
Constant Summary collapse
- L =
RMTools::RMLogger.new(config.logger || {})
- VERSION =
'1.0.0'- 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
250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/rhack/page.rb', line 250 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 |