From afde4ad34377d9a8af10aef5d569b8a53e985447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 26 Feb 2025 21:09:57 +0100 Subject: [PATCH] [tiktok] add 'avatar' option --- docs/configuration.rst | 10 ++++++++++ docs/gallery-dl.conf | 1 + gallery_dl/extractor/tiktok.py | 8 +++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index a700b713..b787a657 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -4336,6 +4336,16 @@ Description Download videos using |ytdl|. +extractor.tiktok.user.avatar +---------------------------- +Type + ``bool`` +Default + ``true`` +Description + Download user avatars. + + extractor.tiktok.user.module ---------------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index c1e861a3..ed85b01b 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -599,6 +599,7 @@ "videos": true, "user": { + "avatar": true, "module": null, "tiktok-range": null } diff --git a/gallery_dl/extractor/tiktok.py b/gallery_dl/extractor/tiktok.py index d7534d62..d6a02966 100644 --- a/gallery_dl/extractor/tiktok.py +++ b/gallery_dl/extractor/tiktok.py @@ -25,9 +25,8 @@ class TiktokExtractor(Extractor): def _init(self): self.audio = self.config("audio", True) self.videos = self.config("videos", True) - - def avatar(self): - return "" + if not self.config("avatar", True): + self.avatar = util.false def items(self): # We assume that all of the URLs served by urls() come from the same @@ -123,6 +122,9 @@ class TiktokExtractor(Extractor): yield Message.Directory, avatar yield Message.Url, avatar_url, avatar + def avatar(self): + return False + def _generate_avatar(self, avatar_url, data, user_name, user_id): avatar = text.nameext_from_url(avatar_url, data.copy()) avatar.update({