优化视频下载逻辑顺序
This commit is contained in:
+13
-24
@@ -444,37 +444,31 @@ namespace dy.net.job
|
||||
var video = await ProcessSingleVideo(cookie, item, data, config, followed);
|
||||
if (video != null)
|
||||
videos.Add(video);
|
||||
else{
|
||||
|
||||
|
||||
// 处理图文视频
|
||||
if (config.DownImageVideo || config.DownMp3 || config.DownImage)
|
||||
{
|
||||
//处理多个视频-组合的图文视频--类似动图。
|
||||
|
||||
if (config.DownDynamicVideo)
|
||||
{
|
||||
List<string> dynamicVideoUrls = new List<string>();
|
||||
if (item.Images != null&& item.Images.Count > 0)
|
||||
// 当需要下载动态视频时,获取其他URL
|
||||
if (config.DownDynamicVideo && item.Images != null && item.Images.Count > 0)
|
||||
{
|
||||
foreach (var img in item.Images)
|
||||
{
|
||||
if (img.DynamicVideo != null&& img.DynamicVideo.BitRate!=null&& img.DynamicVideo.BitRate.Count>0)
|
||||
if (img.DynamicVideo?.BitRate?.Count > 0)
|
||||
{
|
||||
foreach (var btv in img.DynamicVideo.BitRate)
|
||||
{
|
||||
var payAddr = btv.PlayAddr;
|
||||
if(payAddr != null&& payAddr.UrlList!=null&&payAddr.UrlList.Count>0)
|
||||
{
|
||||
dynamicVideoUrls.Add(payAddr.UrlList.FirstOrDefault(x => x.StartsWith("https://www.douyin.com/aweme/v1/play")));
|
||||
}
|
||||
var targetUrl = btv.PlayAddr?.UrlList?.FirstOrDefault(x => x.StartsWith("https://www.douyin.com/aweme/v1/play"));
|
||||
if (targetUrl != null)
|
||||
dynamicVideoUrls.Add(targetUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//说明这个是图文视频里面的动态视频拼接的。。。
|
||||
if (dynamicVideoUrls.Count > 0)
|
||||
// 处理核心逻辑
|
||||
if (config.DownDynamicVideo && dynamicVideoUrls.Count > 0)
|
||||
{
|
||||
// 处理动态视频
|
||||
var dynamicVideo = await ProcessDynamicVideo(dynamicVideoUrls, cookie, item, data, config);
|
||||
if (dynamicVideo != null)
|
||||
{
|
||||
@@ -488,19 +482,14 @@ namespace dy.net.job
|
||||
}
|
||||
else
|
||||
{
|
||||
var mergevideo = await ProcessImageSetAndMergeToVideo(cookie, item, data, config, followed);
|
||||
if (mergevideo != null)
|
||||
videos.Add(mergevideo);
|
||||
}
|
||||
}
|
||||
else
|
||||
// 统一处理图文视频逻辑
|
||||
if (config.DownImageVideo || config.DownMp3 || config.DownImage)
|
||||
{
|
||||
var mergevideo = await ProcessImageSetAndMergeToVideo(cookie, item, data, config, followed);
|
||||
if (mergevideo != null)
|
||||
videos.Add(mergevideo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return videos;
|
||||
|
||||
Reference in New Issue
Block a user