Skip to content

Commit

Permalink
Merge pull request #149 from booxter/runtime-fallback-to-lb
Browse files Browse the repository at this point in the history
Fall back on letterboxd when justwatch doesn't know about the movie
  • Loading branch information
booxter authored Nov 22, 2024
2 parents 48ba885 + b786c0f commit 98ba5f5
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 98ba5f5

Please sign in to comment.