Method: Query::Engine::Qihu#query
- Defined in:
- lib/query/engine/qihu.rb
#query(wd) ⇒ Object
基本查询, 相当于在搜索框直接数据关键词查询
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/query/engine/qihu.rb', line 11 def query(wd) #用原始路径请求 uri = URI.join("http://#{Host}/",URI.encode('s?q='+wd)).to_s page = HTTParty.get(uri,Options) #如果请求地址被跳转,重新获取当前页的URI,可避免翻页错误 uri = URI.join("http://#{Host}/",page.request.path).to_s r = Query::Result::Qihu.new(page) r.baseuri = uri r end |