From 262e8628faba7a535c340644d51d47385204e7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 2 Mar 2025 14:50:49 +0100 Subject: [PATCH] [tiktok] improve 'tiktok-range' parsing (#7098) replace values evaluating as False (except 0) with "" --- gallery_dl/extractor/tiktok.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/tiktok.py b/gallery_dl/extractor/tiktok.py index f129b1c0..203b1acc 100644 --- a/gallery_dl/extractor/tiktok.py +++ b/gallery_dl/extractor/tiktok.py @@ -219,6 +219,11 @@ class TiktokUserExtractor(TiktokExtractor): self.log.debug("", exc_info=exc) raise exception.ExtractionError("yt-dlp or youtube-dl is required " "for this feature!") + + ytdl_range = self.config("tiktok-range") + if ytdl_range is None or not ytdl_range and ytdl_range != 0: + ytdl_range = "" + extr_opts = { "extract_flat" : True, "ignore_no_formats_error": True, @@ -227,7 +232,7 @@ class TiktokUserExtractor(TiktokExtractor): "retries" : self._retries, "socket_timeout" : self._timeout, "nocheckcertificate" : not self._verify, - "playlist_items" : str(self.config("tiktok-range", "")), + "playlist_items" : str(ytdl_range), } if self._proxies: user_opts["proxy"] = self._proxies.get("http")