query 0.1.23 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e0dd534e82e96f66579c0d5b9533be3d3f63983
4
- data.tar.gz: ccc1e5baee2d1fe441b98bc68fed3be70d603142
3
+ metadata.gz: c95c194c67e1ea98bd3b1acda8d6d1f5820bfbe4
4
+ data.tar.gz: 295dfac6c23a431ff8c81cc5f98490d516d2bc53
5
5
  SHA512:
6
- metadata.gz: 26b548b92c64dd7431b459344c591634a3d24ebe79f6ce2c9632503f4f801ef8f8a502cfbaf3d897190cc954dcc90ce01e4fbf1477d68d4507da0c1a7778be75
7
- data.tar.gz: 055fac0339f710c6f931778f1e7072f127684173a16d32bedbc1aedfa05422d7bb4c581a6c5be9994dc6dbf9510966508eb6587f0bdb88e3872c14ebfd0275f2
6
+ metadata.gz: c64749e7bb27d51fcc5721495f866eb39f468d2bc9d8d1f78873bfe3ab7dd227815e9843be1519d1a40ea0b90fbd6ae24980f228cbde72756831e67045f32d73
7
+ data.tar.gz: 5657fdadf58e46fed30182311bc1e18b84c95e1d2d3cc210eb24bd0cc55ffbc7ddd95319fbed3057698023f3df375e8f590b60ea37182a4225408b8100ce58a9
data/README.md CHANGED
@@ -1,7 +1,17 @@
1
1
  Query
2
2
  ==========
3
3
 
4
+ 现在抓百度下拉框可以用代理了
4
5
 
6
+ ```ruby
7
+ require 'query'
8
+ opt = {
9
+ http_proxyaddr: '0.0.0.0',
10
+ http_proxyport: 80
11
+ }
12
+
13
+ puts ::Query::Engine::Baidu.suggestions('abc',opt)
14
+ ```
5
15
 
6
16
  #to get the result list by querying "abc"
7
17
 
@@ -8,10 +8,10 @@ module Query
8
8
  :headers => {"User-Agent" => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11'}
9
9
  }
10
10
 
11
- def self.suggestions(query)
11
+ def self.suggestions(query,options = [])
12
12
  require 'json'
13
13
  query = URI.encode(query)
14
- suggestions = HTTParty.get("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=#{query}&json=1&p=3&sid=&req=2&csor=0&cb=jQuery1102036467162938788533_1437556180622&_=#{(Time.now.to_f*1000).to_i}")
14
+ suggestions = HTTParty.get("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=#{query}&json=1&p=3&sid=&req=2&csor=0&cb=jQuery1102036467162938788533_1437556180622&_=#{(Time.now.to_f*1000).to_i}",options)
15
15
  suggestions.force_encoding('GB18030').encode('UTF-8').delete('jQuery1102036467162938788533_1437556180622(').delete(')').scan(/"q": "([^"]+)"/).flatten.uniq
16
16
  end
17
17
  #to find out the real url for something lik 'www.baidu.com/link?url=7yoYGJqjJ4zBBpC8yDF8xDhctimd_UkfF8AVaJRPKduy2ypxVG18aRB5L6D558y3MjT_Ko0nqFgkMoS'
data/lib/query/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Query
2
- VERSION = "0.1.23"
2
+ VERSION = "0.1.24"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - seoaqua