[tiktok] add 'avatar' option

This commit is contained in:
Mike Fährmann
2025-02-26 21:09:57 +01:00
parent 5e87aee32d
commit afde4ad343
3 changed files with 16 additions and 3 deletions

View File

@@ -4336,6 +4336,16 @@ Description
Download videos using |ytdl|. Download videos using |ytdl|.
extractor.tiktok.user.avatar
----------------------------
Type
``bool``
Default
``true``
Description
Download user avatars.
extractor.tiktok.user.module extractor.tiktok.user.module
---------------------------- ----------------------------
Type Type

View File

@@ -599,6 +599,7 @@
"videos": true, "videos": true,
"user": { "user": {
"avatar": true,
"module": null, "module": null,
"tiktok-range": null "tiktok-range": null
} }

View File

@@ -25,9 +25,8 @@ class TiktokExtractor(Extractor):
def _init(self): def _init(self):
self.audio = self.config("audio", True) self.audio = self.config("audio", True)
self.videos = self.config("videos", True) self.videos = self.config("videos", True)
if not self.config("avatar", True):
def avatar(self): self.avatar = util.false
return ""
def items(self): def items(self):
# We assume that all of the URLs served by urls() come from the same # 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.Directory, avatar
yield Message.Url, avatar_url, avatar yield Message.Url, avatar_url, avatar
def avatar(self):
return False
def _generate_avatar(self, avatar_url, data, user_name, user_id): def _generate_avatar(self, avatar_url, data, user_name, user_id):
avatar = text.nameext_from_url(avatar_url, data.copy()) avatar = text.nameext_from_url(avatar_url, data.copy())
avatar.update({ avatar.update({