Skip to content

Instantly share code, notes, and snippets.

@konart
Created October 26, 2014 20:50
Show Gist options
  • Save konart/c0dbe90def4cbd56ddcf to your computer and use it in GitHub Desktop.
Save konart/c0dbe90def4cbd56ddcf to your computer and use it in GitHub Desktop.
Grab info from tadviser
import urllib
import requests
from lxml import html
url = 'http://www.tadviser.ru/index.php'
c = '/index.php/Компания:'
data = {}
data['ptype'] = 'comp_otr'
data['title'] = 'Категория:Информационные_технологии'
url_values = urllib.urlencode(data)
fullurl = url + '?' + url_values
page = requests.get(fullurl)
tree = html.fromstring(page.text)
companies = tree.xpath('//a[starts-with(@href, c)]/text()')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment