Class: Seotracker::Yandex
- Inherits:
-
Seotracker
- Object
- Seotracker
- Seotracker::Yandex
- Defined in:
- lib/seotracker/yandex.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Direct
Constant Summary collapse
- SEARCH_URL =
'http://yandex.ru/yandsearch?'
- WORDSTAT_URL =
'http://wordstat.yandex.ru/?cmd=words&page=1&&geo=&text_geo=&text='
- MOSCOW =
213
Constants inherited from Seotracker
Instance Method Summary collapse
-
#get_wordstat(word) ⇒ Object
получаем стастистику wordstat word - слово, по которому получаем статистику.
Methods inherited from Seotracker
#debug, #get_position, #initialize
Constructor Details
This class inherits a constructor from Seotracker
Instance Method Details
#get_wordstat(word) ⇒ Object
получаем стастистику wordstat word - слово, по которому получаем статистику
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/seotracker/yandex.rb', line 9 def get_wordstat(word) url = WORDSTAT_URL + word @cookie || page = @agent.get(url, [], nil, { 'cookie' => @cookie }) res = page.root.xpath('/html/body/form/table[2]/tbody/tr/td[4]/table/tbody/tr[3]/td/table/tbody/tr[2]/td[3]') begin res.first.content rescue Exception => e debug "can't get yandex wordstat: #{e.}" 0 end end |