baidu 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/baidu.rb +5 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0a22fe6ad7297b0c4be73cdbe8fefa9b37ad07d
4
- data.tar.gz: 3c19af83a1f22af79404235ee8fef61d165b7677
3
+ metadata.gz: 11d7996ee0521e9b1c35fc3e011f6c4267e33892
4
+ data.tar.gz: 286f0096efcae4f4db6839ea14b5e7c6878a0c84
5
5
  SHA512:
6
- metadata.gz: bf07f1e9e4684cb3ad7aff369b964bc0919a974e5ba526f98103f89206bf03ec198c16fe8543834a77cac25e345cc82a65feb8327ac307d7d2c86f3b0be86add
7
- data.tar.gz: ae6d28052860af86faa7540e67e6c1df19678f080f459da2c0519eed4ab37f71907bbf12479355de11c0bb848d71185ffbcc6e80e4c1ddca95d1902702245bc7
6
+ metadata.gz: 69f3944f3506e84c0649489e5bec624f7df4dccfba5665b50a2473835c5d961ea92ab27b150095ae2b90a7495e1135373089944378efa8f493c9a056c47ac1ad
7
+ data.tar.gz: eb391f043831d459b0e4e843596213a79d098fe23c48ce838a6c4b10a34f92d8e88e7f10c69838cb6a477996ad238fcb39ad0d1e71fa98d0b55840759ffedd43
@@ -126,7 +126,7 @@ class QihooResult < SearchResult
126
126
  end
127
127
  #有结果
128
128
  def has_result?
129
- !@body.xpath('//div[@id="main"]/h3').text().include?'没有找到该URL'
129
+ !@body.search('//div[@id="main"]/h3').text().include?'没有找到该URL'
130
130
  end
131
131
  end
132
132
 
@@ -381,6 +381,7 @@ class BaiduResult < SearchResult
381
381
  url = table.search("[@class=\"g\"]").first
382
382
  url = url.text unless url.nil?
383
383
  a = table.search("a").first
384
+ next if a.nil?
384
385
  @ranks[id]['text'] = a.text
385
386
  @ranks[id]['href'] = url #a.first['href'].sub('http://www.baidu.com/link?url=','').strip
386
387
  unless url.nil?
@@ -467,8 +468,9 @@ class BaiduResult < SearchResult
467
468
  return BaiduResult.new(body,url,@pagenumber+1)
468
469
  # @page = BaiduResult.new(Mechanize.new.click(@page.link_with(:text=>/下一页/))) unless @page.link_with(:text=>/下一页/).nil?
469
470
  end
470
-
471
471
  def has_result?
472
- @page.search('//div[@class="nors"]').empty?
472
+ submit = @page.search('//a[text()="提交网址"]').first
473
+ return false if submit and submit['href'].include?'sitesubmit'
474
+ return true
473
475
  end
474
476
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baidu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - seoaqua