using dy.net.model.dto; using dy.net.model.entity; using dy.net.model.response; using dy.net.service; using dy.net.utils; using dy.net.storage; namespace dy.net.job { public class DouyinMixSyncJob : DouyinBasicSyncJob { public DouyinMixSyncJob(DouyinCookieService douyinCookieService, DouyinHttpClientService douyinHttpClientService, DouyinVideoService douyinVideoService, DouyinCommonService douyinCommonService, DouyinFollowService douyinFollowService, DouyinMergeVideoService douyinMergeVideoService, DouyinCollectCateService douyinCollectCateService, MediaStorageRouter mediaStorageRouter, VideoTaskService videoTaskService) : base(douyinCookieService, douyinHttpClientService, douyinVideoService, douyinCommonService, douyinFollowService, douyinMergeVideoService, douyinCollectCateService, mediaStorageRouter, videoTaskService) { } protected override VideoTypeEnum VideoType => VideoTypeEnum.dy_mix; protected override async Task FetchVideoData(DouyinCookie cookie, string cursor, DouyinFollowed followed, DouyinCollectCate cate) { return await douyinHttpClientService.SyncMixViedosByMixId(cursor, count, cookie.Cookies, cate.XId); } protected override Task> GetSyncCookies() { return GetCookiesWithPathAsync(); } private async Task> GetCookiesWithPathAsync() { var cookies = await douyinCookieService.GetOpendCookiesAsync(); return cookies.Where(x => !string.IsNullOrWhiteSpace(GetStorageRoot(x, VideoType))).ToList(); } protected override string CreateSaveFolder(DouyinCookie cookie, Aweme item, AppConfig config, DouyinFollowed followed, DouyinCollectCate cate) { if (ActiveStorageType.IsRemote()) return BuildRemotePathPlan(cookie, item, config, followed, cate).DirectoryPath; if (cate != null) { var folder = CombineStoragePath(GetStorageRoot(cookie, VideoType), DouyinFileNameHelper.SanitizeLinuxFileName(cate.SaveFolder, cate.Name, true)); EnsureStorageDirectory(folder); return folder; } else { return base.CreateSaveFolder(cookie, item, config, followed, cate); } } protected override string GetAuthorAvatarBasePath(DouyinCookie cookie) { return CombineStoragePath(GetStorageRoot(cookie, VideoType), "author"); } } }