baidu 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/baidu.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11d7996ee0521e9b1c35fc3e011f6c4267e33892
|
4
|
+
data.tar.gz: 286f0096efcae4f4db6839ea14b5e7c6878a0c84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69f3944f3506e84c0649489e5bec624f7df4dccfba5665b50a2473835c5d961ea92ab27b150095ae2b90a7495e1135373089944378efa8f493c9a056c47ac1ad
|
7
|
+
data.tar.gz: eb391f043831d459b0e4e843596213a79d098fe23c48ce838a6c4b10a34f92d8e88e7f10c69838cb6a477996ad238fcb39ad0d1e71fa98d0b55840759ffedd43
|
data/lib/baidu.rb
CHANGED
@@ -126,7 +126,7 @@ class QihooResult < SearchResult
|
|
126
126
|
end
|
127
127
|
#有结果
|
128
128
|
def has_result?
|
129
|
-
!@body.
|
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('//
|
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
|