Class: HttpCrawler::Web::Baidu::Client
- Inherits:
-
Object
- Object
- HttpCrawler::Web::Baidu::Client
show all
- Includes:
- Client
- Defined in:
- lib/http_crawler/web/baidu/client.rb
Instance Attribute Summary
Attributes included from Client
#max_error_num, #response, #uri
Instance Method Summary
collapse
Methods included from Client
#add_error_url, #auto_proxy=, #cookies, for, for_module, #get, #get_proxy, #header, #http, #init_client, #init_header, #init_ssl, #init_timeout, #initialize, #post, #proxy_api, #proxy_params, #update_header, #update_proxy, #update_proxy?, #validation_to_proxy?
Instance Method Details
#index(parameter = {}) ⇒ Object
13
14
15
16
|
# File 'lib/http_crawler/web/baidu/client.rb', line 13
def index(parameter = {})
r = get("/")
r.extend(HttpCrawler::Web::Baidu::Response::Index)
end
|
9
10
11
|
# File 'lib/http_crawler/web/baidu/client.rb', line 9
def init_uri
@uri = URI("https://www.baidu.com")
end
|
#search(parameter = {}) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/http_crawler/web/baidu/client.rb', line 18
def search(parameter = {})
raise "parameter[:keyword] 不能为空" unless parameter[:keyword]
params = {
"wd": parameter[:keyword]
}
r = get("/s",params)
r
end
|