GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/web_programming/get_imdbtop.py at master · D4VA/Python Expand file tree/ Copy pathget_imdbtop.pyMore file actions 20 lines (16 loc) · 718 Bytes / Copy pathget_imdbtop.pyFile metadata and controls20 lines (16 loc) · 718 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import requests from bs4 import BeautifulSoup def imdb_top(imdb_top_n): base_url = ( f"https://www.imdb.com/search/title?title_type=" f"feature&sort=num_votes,desc&count={imdb_top_n}" ) source = BeautifulSoup(requests.get(base_url).content, "html.parser") for m in source.findAll("div", class_="lister-item mode-advanced"): print("\n" + m.h3.a.text) # movie's name print(m.find("span", attrs={"class": "genre"}).text) # genre print(m.strong.text) # movie's rating print(f"https://www.imdb.com{m.a.get('href')}") # movie's page link print("*" * 40) if __name__ == "__main__": imdb_top(input("How many movies would you like to see? ")) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |