Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #encoding: utf-8
- import StringIO, requests, time, operator
- from lxml import html
- from lxml import etree
- r = requests.get("http://talisman.championat.com")
- page_source = r.text.encode('utf-8')
- doc = html.parse(StringIO.StringIO(page_source))
- tmp = []
- for i in doc.xpath("/html/body/div/div/div/div[@class='voting__i _right']") + doc.xpath("/html/body/div/div/div/div[@class='voting__i ']"):
- tmp.append((i.xpath("div[@class='voting__i__title']")[0].text_content().encode('utf8')[21:-37], int(i.xpath("div[@class='voting__i__votes']")[0].text_content())))
- for i in list(reversed(sorted(tmp, key=operator.itemgetter(1))))[:20]:
- print i[0], i[1]
Advertisement
Add Comment
Please, Sign In to add comment