Skip to content

Commit 8dd3540

Browse files
committed
Fix cases where there is no desc #40
1 parent 7938215 commit 8dd3540

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugins/letterboxd.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def get_list(list_id, config=None):
1616
movies = []
1717

1818
while True:
19-
print("Page number: ", page_number)
2019
r = requests.get(f"https://letterboxd.com/{list_id}/detail/by/release-earliest/page/{page_number}/", headers={'User-Agent': 'Mozilla/5.0'})
2120

2221
soup = bs4.BeautifulSoup(r.text, 'html.parser')
@@ -25,8 +24,11 @@ def get_list(list_id, config=None):
2524
list_name = soup.find('h1', {'class': 'title-1 prettify'}).text
2625

2726
if description is None:
28-
description = soup.find('div', {'class': 'body-text'}).find_all('p')
29-
description = "\n".join([p.text for p in description])
27+
description = soup.find('div', {'class': 'body-text'})
28+
if description is not None:
29+
description = "\n".join([p.text for p in description.find_all('p')])
30+
else:
31+
description = ""
3032

3133
for movie_soup in soup.find_all('div', {'class': 'film-detail-content'}):
3234
movie_name = movie_soup.find('h2', {'class': 'headline-2 prettify'}).find('a').text

0 commit comments

Comments
 (0)