Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 3rdman/771e04a64dc51d12c2fd859f4e04a30d to your computer and use it in GitHub Desktop.
Save 3rdman/771e04a64dc51d12c2fd859f4e04a30d to your computer and use it in GitHub Desktop.
...
import urllib2, lxml.html
...
file = urllib2.urlopen('http://m.rp5.ru/7259/ru')
data = file.read()
file.close()
doc = lxml.html.document_fromstring(data)
txt2 = doc.xpath('//*[@class="pr_0"]/text()')
osadki = txt2[0].strip(" \t\n")
txt2 = doc.xpath('//*[@class="finfo"]/text()')
oblach = txt2[4]
txt1 = doc.xpath(".//*[@id='archiveDiv']/text()[10]")
vl_wind = txt1[0].strip(" \t\n").replace(' ', ' ')
txt1 = doc.xpath('//*[@class="wv_1"]/text()')
wins_spd = txt1[0].strip(" \t\n")
print "%s, %s, %s %s" % (osadki, oblach, vl_wind, wins_spd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment