Untitled
unknown
plain_text
a year ago
602 B
1
Indexable
Never
import requests from bs4 import BeautifulSoup url = 'https://www.imdb.com/search/keyword/?keywords=year-2019&ref_=fn_kw_kw_2' response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') movies = soup.find_all('div', {'class': 'lister-item mode-advanced'}) with open("C:\Users\Tamara\Desktop\PROJEKAT\movies.txt", 'w', encoding='utf-8') as file: for movie in movies: title = movie.find('h3', {'class': 'lister-item-header'}).a.text rating = movie.find('div', {'class': 'ratings-bar'}).strong.text file.write(title + ', ' + rating + '\n')