baidu 1.1.9 → 1.2.0

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 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e365ab20a00b69abc98208634364d75b9e353fce
4
- data.tar.gz: 60912cea646f94dfdf4a9df87ba697507cb890ae
3
+ metadata.gz: a0ccac6f51c4aa001ceaab50f302f81fa8b726a3
4
+ data.tar.gz: 837a41fc7cc8441696efb5ff101593b59ccb7f9d
5
5
  SHA512:
6
- metadata.gz: 9079605ab35f9bad3f4a6ea5bc1a4f10857f577bae373d0f55e9f408ef8b03d4951a908829e96f037ef1097f27ef386a1b163f650597bc0514063ea674af506c
7
- data.tar.gz: df97b73c25150cc0bfef6d202db5e73d562e3bd5d3fdd3b8eb93b52f2f934e33353df88418f7fada0566ed5f123e96d98688ef175cb4a0e6be208e7a0928c347
6
+ metadata.gz: 0997551fd051cc82882b9dc79f81b6d7e5ec3fc4da6c6e21911998f4a4bd3a3c37e8a708aeb1528575db9b4fd70868a0557c25d6b4f314818a5dcedf83e4c6b0
7
+ data.tar.gz: a2cf5aea52f773e647179b715f207f89f6516bcc9a9caff2676efc24aa523d791d452ad5240745ea87cdc9f9881e507f2608706dd30d91adaf39397fee466ca9
@@ -396,8 +396,7 @@ class BaiduResult < SearchResult
396
396
  ads = {}
397
397
  id=0
398
398
  @page.search("//table[@class='EC_mr15']|//table[@class='ec_pp_f']").each do |table|
399
- table_id = table['id']
400
- next if table_id.nil?
399
+ next if table['id'].nil?
401
400
  id += 1
402
401
  href = table.search("font[@color='#008000']").text.split(/\s/).first.strip
403
402
  title = table.search("a").first.text.strip
@@ -406,11 +405,13 @@ class BaiduResult < SearchResult
406
405
  ads
407
406
  end
408
407
  def ads_top
408
+ id = 0
409
409
  ads = {}
410
410
  @page.search("//table[@class='EC_mr15']|//table[@class='ec_pp_f']").each do |table|
411
- id = table['id']
411
+ id += 1
412
+ # id = table['id']
412
413
  next unless id.nil?
413
- id = id[-1,1]
414
+ # id = id[-1,1]
414
415
  href = table.search("font[@color='#008000']").text.split(/\s/).first.strip
415
416
  title = table.search("a").first.text.strip
416
417
  ads[id]= {'title'=>title,'href' => href,'host'=>href}
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.1.9
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - seoaqua