From 83b119dadb0f267f1fb66bf7ed74c097349de79e Mon Sep 17 00:00:00 2001 From: sepro Date: Sat, 15 Mar 2025 22:15:29 +0100 Subject: [PATCH] [ie/tiktok] Truncate title (#12566) Authored by: seproDev --- yt_dlp/extractor/tiktok.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index 19336252b1..d9280cec14 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -26,6 +26,7 @@ from ..utils import ( srt_subtitles_timecode, str_or_none, traverse_obj, + truncate_string, try_call, try_get, url_or_none, @@ -444,7 +445,7 @@ class TikTokBaseIE(InfoExtractor): return { 'id': aweme_id, **traverse_obj(aweme_detail, { - 'title': ('desc', {str}), + 'title': ('desc', {truncate_string(left=72)}), 'description': ('desc', {str}), 'timestamp': ('create_time', {int_or_none}), }), @@ -595,7 +596,7 @@ class TikTokBaseIE(InfoExtractor): 'duration': ('duration', {int_or_none}), })), **traverse_obj(aweme_detail, { - 'title': ('desc', {str}), + 'title': ('desc', {truncate_string(left=72)}), 'description': ('desc', {str}), # audio-only slideshows have a video duration of 0 and an actual audio duration 'duration': ('video', 'duration', {int_or_none}, filter), @@ -656,7 +657,7 @@ class TikTokIE(TikTokBaseIE): 'info_dict': { 'id': '6742501081818877190', 'ext': 'mp4', - 'title': 'md5:5e2a23877420bb85ce6521dbee39ba94', + 'title': 'Tag 1 Friend reverse this Video and look what happens 🀩😱 @skyandtami ...', 'description': 'md5:5e2a23877420bb85ce6521dbee39ba94', 'duration': 27, 'height': 1024, @@ -860,7 +861,7 @@ class TikTokIE(TikTokBaseIE): 'info_dict': { 'id': '7253412088251534594', 'ext': 'm4a', - 'title': 'я Ρ€Π΅Π΄ Ρ„Π»Π°Π³ проститС #пСрСписка #щитпост #трСвоТныйтиппривязанности #Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°Ρ†ΠΈΠΈ ', + 'title': 'я Ρ€Π΅Π΄ Ρ„Π»Π°Π³ проститС #пСрСписка #щитпост #трСвоТныйтиппривязанности #Ρ€...', 'description': 'я Ρ€Π΅Π΄ Ρ„Π»Π°Π³ проститС #пСрСписка #щитпост #трСвоТныйтиппривязанности #Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°Ρ†ΠΈΠΈ ', 'uploader': 'hara_yoimiya', 'uploader_id': '6582536342634676230',