fix letterboxd parser

This commit is contained in:
mein Name 2025-03-09 12:02:22 -04:00 committed by Henri Dickson
parent e45980a85a
commit a789f25505

View file

@ -43,16 +43,17 @@ class LetterboxdImporter(Task):
except Exception: except Exception:
return False return False
def get_item_by_url(self, url): @classmethod
def get_item_by_url(cls, url):
try: try:
h = BasicDownloader(url).download().html() h = BasicDownloader(url).download().html()
tu = h.xpath("//a[@data-track-action='TMDb']/@href") tu = h.xpath("//a[@data-track-action='TMDB']/@href")
iu = h.xpath("//a[@data-track-action='IMDb']/@href") iu = h.xpath("//a[@data-track-action='IMDb']/@href")
if not tu: if not tu:
i = h.xpath('//span[@class="film-title-wrapper"]/a/@href') i = h.xpath('//span[@class="film-title-wrapper"]/a/@href')
u2 = "https://letterboxd.com" + i[0] # type:ignore u2 = "https://letterboxd.com" + i[0] # type:ignore
h = BasicDownloader(u2).download().html() h = BasicDownloader(u2).download().html()
tu = h.xpath("//a[@data-track-action='TMDb']/@href") tu = h.xpath("//a[@data-track-action='TMDB']/@href")
iu = h.xpath("//a[@data-track-action='IMDb']/@href") iu = h.xpath("//a[@data-track-action='IMDb']/@href")
if not tu: if not tu:
logger.error(f"Unknown TMDB for {url}") logger.error(f"Unknown TMDB for {url}")