baidu 1.1.9 → 1.2.0
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 -4
- 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: a0ccac6f51c4aa001ceaab50f302f81fa8b726a3
|
|
4
|
+
data.tar.gz: 837a41fc7cc8441696efb5ff101593b59ccb7f9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0997551fd051cc82882b9dc79f81b6d7e5ec3fc4da6c6e21911998f4a4bd3a3c37e8a708aeb1528575db9b4fd70868a0557c25d6b4f314818a5dcedf83e4c6b0
|
|
7
|
+
data.tar.gz: a2cf5aea52f773e647179b715f207f89f6516bcc9a9caff2676efc24aa523d791d452ad5240745ea87cdc9f9881e507f2608706dd30d91adaf39397fee466ca9
|
data/lib/baidu.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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}
|