Advertisement
kika_86

Untitled

Jan 24th, 2020
2,190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests, bs4
  2.  
  3. url = "https://market.yandex.by/catalog--mobilnye-telefony/54726/list?hid=91491&lr=0&onstock=1&local-offers-first=0"
  4. r = requests.get(url)
  5. r.encoding = 'UTF8'
  6.  
  7. b = bs4.BeautifulSoup(r.text, "html.parser")
  8.  
  9. atitles = b.select("h3.n-snippet-cell2__title a")
  10. aprice = b.select("div.n-snippet-cell2__price a")
  11.  
  12. d = {}
  13.  
  14. for a in atitles:
  15.     for a1 in aprice:
  16.         d.setdefault(a.getText(), a1.getText())
  17.  
  18. print(d)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement