Class: HttpCrawler::Web::Baidu::Client
- Inherits:
-
Client
show all
- Defined in:
- lib/http_crawler/web/baidu/client.rb
Instance Attribute Summary
Attributes inherited from Client
#all_timeout, #connect_time, #cookies, #error_urls, #header, #max_error_num, #read_time, #redirect, #response, #uri, #write_time
Instance Method Summary
collapse
Methods inherited from Client
#add_error_url, #auto_proxy=, for, for_module, for_uri, #get, #get_proxy, #get_uri, #http, #inheritance_cookies, #init_cookies, #init_header, #init_ssl, #init_timeout, #initialize, #post, #proxy_api, #proxy_params, #replace_header, #update_cookies, #update_header, #update_proxy, #update_proxy?, #update_uri, #validation_to_proxy?
Instance Method Details
#index(parameter = {}) ⇒ Object
16
17
18
19
|
# File 'lib/http_crawler/web/baidu/client.rb', line 16
def index(parameter = {})
r = get("/")
r.extend(HttpCrawler::Web::Baidu::Response::Index)
end
|
#init_client ⇒ Object
7
8
9
10
|
# File 'lib/http_crawler/web/baidu/client.rb', line 7
def init_client
@all_timeout = 3
end
|
12
13
14
|
# File 'lib/http_crawler/web/baidu/client.rb', line 12
def init_uri
@uri = URI("https://www.baidu.com")
end
|
#search(parameter = {}) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/http_crawler/web/baidu/client.rb', line 21
def search(parameter = {})
raise "parameter[:keyword] 不能为空" unless parameter[:keyword]
params = {
"wd": parameter[:keyword]
}
r = get("/s",params)
r
end
|