SHARE
TWEET

Untitled

kika_86 Jan 24th, 2020 85 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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top