Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. import requests
  3.  
  4. page = requests.get("https://stooq.pl/q/?s=cdr").text
  5. soup = BeautifulSoup(page, 'html.parser')
  6.  
  7. tdf13=soup.findAll("td",{"id":"f13"})
  8. list=[i.span.text for i in tdf13 if i.span!=None]
  9. print("kurs: "+str(list[0])+"\n"+"procentowa zmiana: "+str(list[2])+"\n"+"bezwzględna zmiana: "+str(list[4])+"\n"+"liczba transakcji: "+str(list[10]))
  10.  
  11. ---------------------------------------------------------------------------
  12.  
  13. from bs4 import BeautifulSoup
  14. import requests
  15.  
  16. page = requests.get("https://www.filmweb.pl/film/Narodziny+gwiazdy-2018-542576").text
  17. soup = BeautifulSoup(page, 'html.parser')
  18.  
  19. # reżyser
  20. director=soup.find("li",{"itemprop":"director"}).a['title']
  21. print(director)
  22.  
  23. # premiera
  24. ths=soup.findAll("th")
  25. findPremiera=[th.nextSibling.findAll('span') for th in ths if th.text=="premiera:"]
  26. premiera=f"świat: {findPremiera[0][0].text.strip()}, polska: {findPremiera[0][1].text.strip()}"
  27. print(premiera)
  28.  
  29. # boxoffice
  30. findBoxoffice=[th.nextSibling.text for th in ths if th.text=="boxoffice:"]
  31. print(findBoxoffice[0])
  32.  
  33. # ocena
  34. ocena=soup.find("div",{"itemprop":"aggregateRating"})
  35. print(ocena.find("span").text.strip())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement