Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back on letterboxd when justwatch doesn't know about the movie #149

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/letsrolld/film.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,16 @@ def jw_url(self):
return None
return link

# TODO: extract runtime from letterboxd if quickwatch is not available
@functools.cached_property
def runtime(self):
if self.jw is None:
return None
return self.jw.runtime_minutes
# first, try (structured) justwatch data
if self.jw is not None:
return self.jw.runtime_minutes
# fall back to letterboxd html
for p in self.soup.find_all("p", class_="text-link text-footer"):
match = re.search(r"(\d+)\smins", p.text)
if match:
return int(match.group(1))

@functools.cached_property
def _full_title(self):
Expand Down
Loading