Skip to content

Commit

Permalink
Fixed bug with imdb_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ghomasHudson committed Jun 15, 2024
1 parent cbf137d commit 6a056b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/letterboxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def get_list(list_id, config=None):
if list_name is None:
list_name = soup.find('h1', {'class': 'title-1 prettify'}).text

for movie in soup.find_all('div', {'class': 'film-detail-content'}):
movie_name = movie.find('h2', {'class': 'headline-2 prettify'}).find('a').text
movie_year = movie.find('small', {'class': 'metadata'}).text
for movie_soup in soup.find_all('div', {'class': 'film-detail-content'}):
movie_name = movie_soup.find('h2', {'class': 'headline-2 prettify'}).find('a').text
movie_year = movie_soup.find('small', {'class': 'metadata'}).text
movie = {"title": movie_name, "release_year": movie_year, "media_type": "movie"}

# Find the imdb id
if config.get("imdb_id_filter", False):
r = requests.get(f"https://letterboxd.com{movie.find('a')['href']}", headers={'User-Agent': 'Mozilla/5.0'})
r = requests.get(f"https://letterboxd.com{movie_soup.find('a')['href']}", headers={'User-Agent': 'Mozilla/5.0'})
movie_soup = bs4.BeautifulSoup(r.text, 'html.parser')
imdb_id = movie_soup.find("a", {"data-track-action":"IMDb"})["href"].split("/title/")[1].split("/")[0]
movie["imdb_id"] = imdb_id
Expand Down

0 comments on commit 6a056b0

Please sign in to comment.