From 9e75c6267f14e22f1faab9741b6700039a14955c Mon Sep 17 00:00:00 2001 From: Henri Dickson <90480431+alphatownsman@users.noreply.github.com> Date: Wed, 5 Jun 2024 09:11:37 -0400 Subject: [PATCH] auto select language when search tmdb --- catalog/search/external.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catalog/search/external.py b/catalog/search/external.py index 647b2d8f..7831055e 100644 --- a/catalog/search/external.py +++ b/catalog/search/external.py @@ -11,6 +11,7 @@ from lxml import html from catalog.common import * from catalog.models import * from catalog.sites.spotify import get_spotify_token +from catalog.sites.tmdb import get_language_code SEARCH_PAGE_SIZE = 5 # not all apis support page size logger = logging.getLogger(__name__) @@ -172,7 +173,7 @@ class TheMovieDatabase: @classmethod def search(cls, q, page=1): results = [] - api_url = f"https://api.themoviedb.org/3/search/multi?query={quote_plus(q)}&page={page}&api_key={settings.TMDB_API3_KEY}&language=zh-CN&include_adult=true" + api_url = f"https://api.themoviedb.org/3/search/multi?query={quote_plus(q)}&page={page}&api_key={settings.TMDB_API3_KEY}&language={get_language_code()}&include_adult=true" try: j = requests.get(api_url, timeout=2).json() if j.get("results"):