Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Name: модуль1
  3. # Purpose:
  4. #
  5. # Author: user
  6. #
  7. # Created: 21.11.2018
  8. # Copyright: (c) user 2018
  9. # Licence: <your licence>
  10. #-------------------------------------------------------------------------------
  11. import requests
  12. from lxml import html
  13. r = requests.get('http://www.ot76.ru/mob/list.php?vt=1')
  14. tree = html.fromstring(r.content)
  15. xp1 = tree.xpath('//a')
  16. v = input()
  17. st = []
  18. st1 =[]
  19. for i in xp1:
  20. txt = i.text.split()[0]
  21. if v == txt:
  22. print('Нашел')
  23. r = requests.get('http://www.ot76.ru/mob/' + i.attrib['href'])
  24. tree = html.fromstring(r.content)
  25. xp2 = tree.xpath('//td')
  26. a = False
  27. for j in xp2:
  28. txt1 = j
  29. if txt1 != None:
  30. a = True
  31. if a == False:
  32. pass
  33. else:
  34. st.append(txt1)
  35. print(st[9].text)
  36. for h in st[-1]:
  37. if len(h.attrib) != 0:
  38. r = requests.get('http://www.ot76.ru/mob/' + h.attrib['href'])
  39. tree = html.fromstring(r.content)
  40. xp3 = tree.xpath('//td')
  41. for h in xp3:
  42. txt2 = h.text
  43. if txt2 != None and ':' in txt2:
  44. print(txt2)
  45. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement