从 TMDB 相对链接中解析数值 ID。

This commit is contained in:
sowevo
2025-08-13 17:11:56 +08:00
parent 4c979c458e
commit b0d17deda1

View File

@@ -404,10 +404,7 @@ class TmdbApi:
return int(match.group(1))
except Exception:
return None
# 兜底:取最后段再取数字前缀
last = link.rsplit("/", 1)[-1]
num_match = re.match(r"^(\d+)", last)
return int(num_match.group(1)) if num_match else None
return None
@staticmethod
def __get_names(tmdb_info: dict) -> List[str]: