Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. from requests import Session, get, post
  3.  
  4. filmy_jakuba = []
  5. filmy_emili = []
  6.  
  7. with Session() as s:
  8.     url = "https://www.filmweb.pl/j_login"
  9.     payload = {'j_username': 'coen00', 'j_password': ' '}
  10.     s.post(url, data=payload)
  11.     # An authorised request.
  12.     for i in range(1, 15):
  13.         pageC = s.get("https://www.filmweb.pl/user/coen00/wantToSee?page="+str(i)+"")
  14.         pageN = s.get("https://www.filmweb.pl/user/bornforburning/wantToSee?page="+str(i)+"")
  15.         # print(page.url)
  16.         soupC = BeautifulSoup(pageC.content, 'html.parser')
  17.         soupN = BeautifulSoup(pageN.content, 'html.parser')
  18.         moviesC = soupC.find_all("h3", class_="filmPreview__title")
  19.         moviesN = soupN.find_all("h3", class_="filmPreview__title")
  20.  
  21.         for x in moviesN:
  22.             filmy_emili.append(x.getText())
  23.         for x in moviesC:
  24.             filmy_jakuba.append(x.getText())
  25. wspolne = list(set(filmy_jakuba).intersection(filmy_emili))
  26.  
  27. print("Jakub: ")
  28. print(filmy_jakuba)
  29. print("Kicia:")
  30. print(filmy_emili)
  31. print("Wspólne: " + str(len(wspolne)))
  32. print(wspolne)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement