baiduserp 2.0.4 → 2.0.5

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: b76e9892fceaa4719a61d4aed6fb01b8b01166d6
4
- data.tar.gz: da46214d67c3f50436f1a7860096bf643e1c876e
3
+ metadata.gz: 1138e5971b4ff973f8abd7096fe76997887f7f9d
4
+ data.tar.gz: 9582079945b7ad67a128107429927ea1831bbfb6
5
5
  SHA512:
6
- metadata.gz: b16b248268416b165ac3a2811c858bd279afeeca6baaac7dd5aa834e80668ebd87822e04cc2ad07e792a33e7ad688dabb9fe4eb0e06c3daeaed9d62e2605d58e
7
- data.tar.gz: ecca635c80e68467dce468e738b25246a386c2d48d5f1811108daaf881fe677926a31984b04c4552eddc8e25c6017c353e6cacbb86a4fc8d093a32edbe9b7740
6
+ metadata.gz: 5e8e18d34e4820b2e1b7e2d55c23d15b562c5e8b14a7084c15657fe1dd718de50b35897c0e5642d551acb3e342a7b824e91eae462bcd8448c1a8944e30d3d174
7
+ data.tar.gz: dea624fc9c1231affe3d0a9e7344dc6ae325ab0c9b6f1c77ecd4caa9d8eff2909b1d911ab3f16574a453617683d759e7c0da92746370965b9bfae4814ec02b08
@@ -1,3 +1,3 @@
1
1
  module Baiduserp
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
data/lib/parsers/ranks.rb CHANGED
@@ -10,7 +10,12 @@ class Baiduserp::Parser
10
10
  url = table.search('h3/a').first
11
11
  unless url.nil?
12
12
  url = url['href']
13
- url = Baiduserp::Client.get(url).headers['location'] if url.include?('http://www.baidu.com/link?')
13
+ begin
14
+ url = Baiduserp::Client.get(url).headers['location'] if url.include?('http://www.baidu.com/link?')
15
+ rescue Exception
16
+ sleep(10)
17
+ retry
18
+ end
14
19
  end
15
20
  r[:url] = url
16
21
 
@@ -3,7 +3,7 @@
3
3
  class Baiduserp::Parser
4
4
  def _parse_result_num(file)
5
5
  html = file[:html]
6
- str = html.scan(/找到相关结果(.*)个/).join
6
+ str = html.scan(/百度为您找到相关结果(.*)个/).join
7
7
  str = str.gsub('约','')
8
8
  if str.include?('万')
9
9
  parts = str.split('万')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baiduserp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - MingQian Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-25 00:00:00.000000000 Z
11
+ date: 2013-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.0.0
85
+ rubygems_version: 2.0.3
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Baidu SERP