Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Name: модуль1
- # Purpose:
- #
- # Author: user
- #
- # Created: 21.11.2018
- # Copyright: (c) user 2018
- # Licence: <your licence>
- #-------------------------------------------------------------------------------
- import requests
- from lxml import html
- r = requests.get('http://www.ot76.ru/mob/list.php?vt=1')
- tree = html.fromstring(r.content)
- xp1 = tree.xpath('//a')
- v = input()
- st = []
- st1 =[]
- for i in xp1:
- txt = i.text.split()[0]
- if v == txt:
- print('Нашел')
- r = requests.get('http://www.ot76.ru/mob/' + i.attrib['href'])
- tree = html.fromstring(r.content)
- xp2 = tree.xpath('//td')
- a = False
- for j in xp2:
- txt1 = j
- if txt1 != None:
- a = True
- if a == False:
- pass
- else:
- st.append(txt1)
- print(st[9].text)
- for h in st[-1]:
- if len(h.attrib) != 0:
- r = requests.get('http://www.ot76.ru/mob/' + h.attrib['href'])
- tree = html.fromstring(r.content)
- xp3 = tree.xpath('//td')
- for h in xp3:
- txt2 = h.text
- if txt2 != None and ':' in txt2:
- print(txt2)
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement