Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. string = input("What is the string?\n")
  5.  
  6. URL = ('http://poe.trade/search/' + string)
  7.  
  8. headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'}
  9.  
  10. page = requests.get(URL, headers=headers)
  11.  
  12. soup = BeautifulSoup(page.content, 'html.parser')
  13.  
  14. title = soup.findAll("tbody",{"id":"item-container-0"})
  15. price = soup.findAll("span",{"class":"currency"})
  16.  
  17. for container in title:
  18. title = container["data-name"]
  19. print(title)
  20.  
  21. for container in price:
  22. price = container["title"]
  23. print(price)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement