Class: Query::Result::SMobile
- Inherits:
-
Object
- Object
- Query::Result::SMobile
show all
- Includes:
- Query::Result
- Defined in:
- lib/query/result/sm_mobile.rb
Defined Under Namespace
Classes: XpathFunctions
Instance Attribute Summary
#baseuri, #options, #pagenumber, #perpage
Instance Method Summary
collapse
#initialize, #next, #rank, #raw_ranks
Instance Method Details
#ads_bottom ⇒ Object
19
20
21
22
23
24
|
# File 'lib/query/result/sm_mobile.rb', line 19
def ads_bottom
selector = "//div[@id='results']/div[@class='result card'][1]/following-sibling::div[@class='ali_row result card']"
@ads_bottom ||= @page.search(selector).map.with_index do |ad_div,index|
parse_ad(ad_div).merge({:rank => (index + 1) + (@pagenumber -1) * 10})
end
end
|
#ads_right ⇒ Object
35
36
37
|
# File 'lib/query/result/sm_mobile.rb', line 35
def ads_right
[]
end
|
#ads_top ⇒ Object
12
13
14
15
16
17
|
# File 'lib/query/result/sm_mobile.rb', line 12
def ads_top
selector = "//div[@id='results']/div[@class='result card'][1]/preceding-sibling::div[@class='ali_row result card']"
@ads_top ||= @page.search(selector).map.with_index do |ad_div,index|
parse_ad(ad_div).merge({:rank => (index + 1) + (@pagenumber -1) * 10})
end
end
|
#count ⇒ Object
43
44
45
|
# File 'lib/query/result/sm_mobile.rb', line 43
def count
end
|
#html ⇒ Object
31
32
33
|
# File 'lib/query/result/sm_mobile.rb', line 31
def html
@page.to_html
end
|
#next_url ⇒ Object
39
40
41
|
# File 'lib/query/result/sm_mobile.rb', line 39
def next_url
"#{@baseuri.to_s}&page=#{@pagenumber+1}"
end
|
27
28
29
|
# File 'lib/query/result/sm_mobile.rb', line 27
def related_keywords
@related_keywords ||= @page.search("//div[@class='rel-keywords card']/ul/li/a").map { |a| a.text }
end
|
#seo_ranks ⇒ Object
6
7
8
9
10
|
# File 'lib/query/result/sm_mobile.rb', line 6
def seo_ranks
@seo_ranks ||= @page.search("//div[@id='results']/div[@class!='ali_row result card']").map.with_index do |seo_div,index|
parse_seo(seo_div).merge({:rank => (index + 1) + (@pagenumber -1) * 10})
end
end
|