[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|.
extractor.tiktok.user.avatar
----------------------------
Type
``bool``
Default
``true``
Description
Download user avatars.
extractor.tiktok.user.module
----------------------------
Type

View File

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

View File

@@ -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({