Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import requests
- page_link = "https://www.imdb.com/search/title?groups=top_250&sort=user_rating,desc"
- # response
- page_response = requests.get(page_link, timeout=5)
- #here we have page content -> check structure of webpage
- page_content = BeautifulSoup(page_response.content, "html.parser")
- movie_containers = page_content.find_all('div', class_ = 'lister-item mode-advanced')
- for movie in movie_containers:
- #name
- print("Name: "+movie.a.img['alt'])
- print("\tYear: "+movie.find("span", {"class": "lister-item-year text-muted unbold"}).text[1:-1])
- print("\tRating: "+movie.find("div", {"class": "inline-block ratings-imdb-rating"})["data-value"])
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement