From d30198d1e2f8a4a3953f1176cc95aa57ed5839b8 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 18 Dec 2024 00:08:04 +0800 Subject: [PATCH 1/2] limit filename length to 255 --- src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs b/src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs index 0abee42..a56a0dc 100644 --- a/src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs +++ b/src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs @@ -177,7 +177,8 @@ private async Task DownloadAll() } var filepath = _appConfig.Value.DownloadPath; - var filename = "#" + Data.AuthorName + "#" + Data.UniqueId + "# "+ Data.Desc + ".mp4"; + var filename = "#" + Data.AuthorName + "#" + Data.UniqueId + "# " + Data.Desc; + filename = filename.Substring(0, Math.Min(250, ("#" + Data.AuthorName + "#" + Data.UniqueId + "# " + Data.Desc).Length))+".mp4"; var replaceFilename = filename.ReplaceInvalidCharacters(); From ae8ed8538c612e309f20e843701decd9e1381f56 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 18 Dec 2024 00:21:16 +0800 Subject: [PATCH 2/2] Use shortId if uniqueId is empty. --- src/BlueCatKoKo.Ui/Services/DouYinShortVideoService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BlueCatKoKo.Ui/Services/DouYinShortVideoService.cs b/src/BlueCatKoKo.Ui/Services/DouYinShortVideoService.cs index cb11401..e88aedb 100644 --- a/src/BlueCatKoKo.Ui/Services/DouYinShortVideoService.cs +++ b/src/BlueCatKoKo.Ui/Services/DouYinShortVideoService.cs @@ -2,6 +2,7 @@ using System.IO; using System.Net.Http; using System.Text.RegularExpressions; +using System.Xml; using BlueCatKoKo.Ui.Constants; using BlueCatKoKo.Ui.Models; using Downloader; @@ -108,7 +109,7 @@ public async Task ExtractVideoDataAsync(string url) Platform = ShortVideoPlatformEnum.DouYin, VideoId = videoInfoData.AwemeId, AuthorName = videoInfoData.Author.Nickname, - UniqueId = videoInfoData.Author.UniqueId, + UniqueId = videoInfoData.Author.UniqueId==""?videoInfoData.Author.ShortId:videoInfoData.Author.UniqueId, AuthorAvatar = videoInfoData.Author.AvatarThumb.UrlList.First().ToString(), Title = videoInfoData.Author.Signature, Cover = videoInfoData.Video.Cover.UrlList.Last().ToString(),