去掉大量多余的配置
@@ -293,19 +293,17 @@ namespace dy.net.Controllers
|
||||
[HttpPost("UpdateConfig")]
|
||||
public async Task<IActionResult> UpdateConfig(AppConfig config)
|
||||
{
|
||||
var data = await commonService.UpdateConfig(config);
|
||||
if (data)
|
||||
var update = await commonService.UpdateConfig(config);
|
||||
if (update)
|
||||
{
|
||||
if (config.OnlySyncNew)
|
||||
{
|
||||
var d = await douyinCookieService.SetOnlySyncNew();
|
||||
if (d)
|
||||
Serilog.Log.Debug("仅同步新视频配置已生效,后续所有类型的视频同步将只会读取最近一页约20条数据");
|
||||
}
|
||||
|
||||
ReStartJob();
|
||||
}
|
||||
return ApiResult.Success(data);
|
||||
return ApiResult.Success(update);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -217,10 +217,10 @@ namespace dy.net
|
||||
// 更新视频类型--兼容老版本--不再需要
|
||||
//commonService.UpdateCollectViedoType();
|
||||
// 重置博主作品同步状态为未同步
|
||||
commonService.UpdateAllCookieSyncedToZero();
|
||||
//commonService.UpdateAllCookieSyncedToZero();
|
||||
// 初始化配置
|
||||
var config = commonService.InitConfig();
|
||||
//if (!isDevelopment)
|
||||
if (!isDevelopment)
|
||||
{
|
||||
// 启动定时任务
|
||||
var quartzJobService = services.GetRequiredService<DouyinQuartzJobService>();
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
<SelfContained>false</SelfContained>
|
||||
<!--<DockerArch>x86</DockerArch>-->
|
||||
<!--<DockerArch>arm</DockerArch> -->
|
||||
<!--<DockerCoreVersion>1.9.8</DockerCoreVersion>-->
|
||||
<!--<DockerCoreVersion>2.0.1</DockerCoreVersion>-->
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl>
|
||||
<History>True|2026-01-21T17:37:53.6972395Z||;True|2026-01-22T01:34:14.2142463+08:00||;True|2026-01-22T01:32:50.9228911+08:00||;True|2026-01-22T01:29:43.8871986+08:00||;True|2026-01-22T01:29:40.7838709+08:00||;True|2026-01-22T01:27:34.4763970+08:00||;True|2026-01-22T01:26:55.0117367+08:00||;True|2026-01-22T01:23:19.4789587+08:00||;True|2026-01-19T10:19:44.8997385+08:00||;True|2026-01-19T10:11:10.2305307+08:00||;True|2026-01-17T00:52:08.8180346+08:00||;False|2026-01-17T00:52:03.1829000+08:00||;True|2026-01-17T00:45:04.0498090+08:00||;True|2026-01-16T21:00:57.7239379+08:00||;True|2026-01-16T21:00:03.3912989+08:00||;True|2026-01-16T20:56:08.5505592+08:00||;True|2026-01-16T20:46:32.3067302+08:00||;True|2026-01-15T22:18:57.9835738+08:00||;True|2026-01-15T22:07:25.4753938+08:00||;True|2026-01-15T22:07:14.8243754+08:00||;True|2026-01-15T21:40:13.2613927+08:00||;True|2026-01-15T20:57:56.6291682+08:00||;True|2026-01-15T20:57:47.1363536+08:00||;True|2026-01-15T20:08:44.4710883+08:00||;True|2026-01-15T20:04:51.8284314+08:00||;False|2026-01-15T20:04:45.3258155+08:00||;True|2026-01-15T19:59:11.7907672+08:00||;True|2026-01-15T01:10:48.9066941+08:00||;True|2026-01-15T01:03:23.6216975+08:00||;True|2026-01-15T01:03:16.3364591+08:00||;False|2026-01-15T01:03:10.5654436+08:00||;True|2026-01-15T00:49:21.6559622+08:00||;True|2026-01-15T00:10:42.7288439+08:00||;True|2026-01-15T00:06:28.4241682+08:00||;True|2026-01-13T22:34:15.2372411+08:00||;True|2026-01-13T22:26:46.4522947+08:00||;True|2026-01-13T22:15:56.9735179+08:00||;True|2026-01-13T22:15:51.8250677+08:00||;False|2026-01-13T22:15:46.6608690+08:00||;True|2026-01-13T22:03:06.4683237+08:00||;False|2026-01-13T22:03:01.2036027+08:00||;True|2026-01-13T21:36:05.8776209+08:00||;True|2026-01-13T21:33:02.0766289+08:00||;False|2026-01-13T21:32:57.1976141+08:00||;True|2026-01-13T19:14:35.2519439+08:00||;True|2026-01-13T15:07:50.0836745+08:00||;False|2026-01-13T15:06:35.5929685+08:00||;True|2026-01-13T10:21:41.6012776+08:00||;True|2026-01-13T09:57:25.4788847+08:00||;True|2026-01-13T09:53:14.4900360+08:00||;True|2026-01-13T09:23:53.6465295+08:00||;True|2026-01-12T22:04:14.5886955+08:00||;False|2026-01-12T22:04:08.2008101+08:00||;True|2026-01-12T21:53:46.9947176+08:00||;True|2026-01-12T21:11:15.8358024+08:00||;True|2026-01-12T21:09:51.8663228+08:00||;True|2026-01-11T21:25:07.5052845+08:00||;False|2026-01-11T21:24:27.5744557+08:00||;True|2026-01-11T19:59:15.4734611+08:00||;False|2026-01-11T19:59:04.9543339+08:00||;True|2026-01-11T18:51:30.6649269+08:00||;True|2026-01-08T21:07:57.5094466+08:00||;True|2026-01-08T14:51:18.2266231+08:00||;True|2026-01-08T14:31:55.1137120+08:00||;True|2026-01-08T00:16:24.4451490+08:00||;True|2026-01-08T00:14:20.7430793+08:00||;True|2026-01-08T00:07:46.7228194+08:00||;True|2026-01-07T23:52:13.3290082+08:00||;True|2026-01-07T23:49:28.4838650+08:00||;True|2026-01-07T23:47:45.1936189+08:00||;True|2026-01-07T23:35:09.7818611+08:00||;True|2026-01-07T23:20:43.7462863+08:00||;True|2026-01-07T23:04:39.5140429+08:00||;False|2026-01-07T23:04:36.5367611+08:00||;True|2026-01-07T22:53:14.6013449+08:00||;True|2026-01-07T22:49:59.9549006+08:00||;True|2026-01-07T22:36:40.0254856+08:00||;False|2026-01-07T22:36:28.8275903+08:00||;True|2026-01-07T21:59:51.4355171+08:00||;True|2026-01-03T21:38:51.4307034+08:00||;True|2026-01-02T19:09:16.9668906+08:00||;False|2026-01-02T19:09:11.7496369+08:00||;True|2026-01-02T15:42:08.2215697+08:00||;True|2026-01-02T09:46:56.1654861+08:00||;True|2026-01-02T09:35:28.0211225+08:00||;True|2026-01-01T23:07:01.9022045+08:00||;False|2026-01-01T23:06:56.0537216+08:00||;True|2026-01-01T22:16:10.2974067+08:00||;True|2026-01-01T22:16:06.2123787+08:00||;False|2026-01-01T22:15:33.3626979+08:00||;True|2026-01-01T22:01:30.7161900+08:00||;True|2026-01-01T21:10:19.3664263+08:00||;True|2026-01-01T21:09:38.6071080+08:00||;True|2025-12-30T11:45:54.5543034+08:00||;True|2025-12-30T09:19:08.3178124+08:00||;True|2025-12-29T18:57:29.7032246+08:00||;True|2025-12-27T14:52:24.4780776+08:00||;False|2025-12-27T14:52:19.5635794+08:00||;True|2025-12-27T14:48:01.6252748+08:00||;False|2025-12-27T14:47:55.7976192+08:00||;</History>
|
||||
<History>True|2026-01-22T04:44:28.1577014Z||;True|2026-01-22T12:40:45.7449335+08:00||;True|2026-01-22T12:39:07.0683214+08:00||;True|2026-01-22T09:55:49.7086190+08:00||;True|2026-01-22T01:37:53.6972395+08:00||;True|2026-01-22T01:34:14.2142463+08:00||;True|2026-01-22T01:32:50.9228911+08:00||;True|2026-01-22T01:29:43.8871986+08:00||;True|2026-01-22T01:29:40.7838709+08:00||;True|2026-01-22T01:27:34.4763970+08:00||;True|2026-01-22T01:26:55.0117367+08:00||;True|2026-01-22T01:23:19.4789587+08:00||;True|2026-01-19T10:19:44.8997385+08:00||;True|2026-01-19T10:11:10.2305307+08:00||;True|2026-01-17T00:52:08.8180346+08:00||;False|2026-01-17T00:52:03.1829000+08:00||;True|2026-01-17T00:45:04.0498090+08:00||;True|2026-01-16T21:00:57.7239379+08:00||;True|2026-01-16T21:00:03.3912989+08:00||;True|2026-01-16T20:56:08.5505592+08:00||;True|2026-01-16T20:46:32.3067302+08:00||;True|2026-01-15T22:18:57.9835738+08:00||;True|2026-01-15T22:07:25.4753938+08:00||;True|2026-01-15T22:07:14.8243754+08:00||;True|2026-01-15T21:40:13.2613927+08:00||;True|2026-01-15T20:57:56.6291682+08:00||;True|2026-01-15T20:57:47.1363536+08:00||;True|2026-01-15T20:08:44.4710883+08:00||;True|2026-01-15T20:04:51.8284314+08:00||;False|2026-01-15T20:04:45.3258155+08:00||;True|2026-01-15T19:59:11.7907672+08:00||;True|2026-01-15T01:10:48.9066941+08:00||;True|2026-01-15T01:03:23.6216975+08:00||;True|2026-01-15T01:03:16.3364591+08:00||;False|2026-01-15T01:03:10.5654436+08:00||;True|2026-01-15T00:49:21.6559622+08:00||;True|2026-01-15T00:10:42.7288439+08:00||;True|2026-01-15T00:06:28.4241682+08:00||;True|2026-01-13T22:34:15.2372411+08:00||;True|2026-01-13T22:26:46.4522947+08:00||;True|2026-01-13T22:15:56.9735179+08:00||;True|2026-01-13T22:15:51.8250677+08:00||;False|2026-01-13T22:15:46.6608690+08:00||;True|2026-01-13T22:03:06.4683237+08:00||;False|2026-01-13T22:03:01.2036027+08:00||;True|2026-01-13T21:36:05.8776209+08:00||;True|2026-01-13T21:33:02.0766289+08:00||;False|2026-01-13T21:32:57.1976141+08:00||;True|2026-01-13T19:14:35.2519439+08:00||;True|2026-01-13T15:07:50.0836745+08:00||;False|2026-01-13T15:06:35.5929685+08:00||;True|2026-01-13T10:21:41.6012776+08:00||;True|2026-01-13T09:57:25.4788847+08:00||;True|2026-01-13T09:53:14.4900360+08:00||;True|2026-01-13T09:23:53.6465295+08:00||;True|2026-01-12T22:04:14.5886955+08:00||;False|2026-01-12T22:04:08.2008101+08:00||;True|2026-01-12T21:53:46.9947176+08:00||;True|2026-01-12T21:11:15.8358024+08:00||;True|2026-01-12T21:09:51.8663228+08:00||;True|2026-01-11T21:25:07.5052845+08:00||;False|2026-01-11T21:24:27.5744557+08:00||;True|2026-01-11T19:59:15.4734611+08:00||;False|2026-01-11T19:59:04.9543339+08:00||;True|2026-01-11T18:51:30.6649269+08:00||;True|2026-01-08T21:07:57.5094466+08:00||;True|2026-01-08T14:51:18.2266231+08:00||;True|2026-01-08T14:31:55.1137120+08:00||;True|2026-01-08T00:16:24.4451490+08:00||;True|2026-01-08T00:14:20.7430793+08:00||;True|2026-01-08T00:07:46.7228194+08:00||;True|2026-01-07T23:52:13.3290082+08:00||;True|2026-01-07T23:49:28.4838650+08:00||;True|2026-01-07T23:47:45.1936189+08:00||;True|2026-01-07T23:35:09.7818611+08:00||;True|2026-01-07T23:20:43.7462863+08:00||;True|2026-01-07T23:04:39.5140429+08:00||;False|2026-01-07T23:04:36.5367611+08:00||;True|2026-01-07T22:53:14.6013449+08:00||;True|2026-01-07T22:49:59.9549006+08:00||;True|2026-01-07T22:36:40.0254856+08:00||;False|2026-01-07T22:36:28.8275903+08:00||;True|2026-01-07T21:59:51.4355171+08:00||;True|2026-01-03T21:38:51.4307034+08:00||;True|2026-01-02T19:09:16.9668906+08:00||;False|2026-01-02T19:09:11.7496369+08:00||;True|2026-01-02T15:42:08.2215697+08:00||;True|2026-01-02T09:46:56.1654861+08:00||;True|2026-01-02T09:35:28.0211225+08:00||;True|2026-01-01T23:07:01.9022045+08:00||;False|2026-01-01T23:06:56.0537216+08:00||;True|2026-01-01T22:16:10.2974067+08:00||;True|2026-01-01T22:16:06.2123787+08:00||;False|2026-01-01T22:15:33.3626979+08:00||;True|2026-01-01T22:01:30.7161900+08:00||;True|2026-01-01T21:10:19.3664263+08:00||;True|2026-01-01T21:09:38.6071080+08:00||;True|2025-12-30T11:45:54.5543034+08:00||;True|2025-12-30T09:19:08.3178124+08:00||;True|2025-12-29T18:57:29.7032246+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -35,7 +35,6 @@
|
||||
Cookie 及 `sec_user_id` 是同步功能的核心,需严格按步骤获取,避免遗漏或错误。
|
||||
|
||||
|
||||
|
||||
### 1.1 提取`Cookie`以及 `sec_uer_id`
|
||||
1. 打开 **抖音网页版** (https://www.douyin.com/) 并登录目标账号;
|
||||
2. 进入个人主页,按下F12进入开发者模式、并切换到 `网络`(也可能叫`network`).
|
||||
@@ -66,7 +65,8 @@ Cookie 及 `sec_user_id` 是同步功能的核心,需严格按步骤获取,
|
||||
| 个人喜欢视频 | `/app/favorite` | 映射到本地目录(建议与收藏视频路径区分,如 `/volume1/抖音/喜欢`) | 存储同步后的「我喜欢」视频 |
|
||||
| 图文视频 | `/app/images` | 映射到本地目录(建议与收藏视频路径区分,如 `/volume1/抖音/图文视频`) | 存储同步后的「图文视频」 |
|
||||
| 指定博主视频 | `/app/uper` | 映射到本地目录(如 `/volume1/抖音/博主作品`) | 存储同步后的博主视频 |
|
||||
| 数据库文件 | `/app/db` | 映射到本地稳定目录(如 `/volume1/抖音/工具数据库`) | 持久化配置、同步记录 |
|
||||
| 数据库文件 | `/app/db` | 映射到本地稳定目录(如 `/volume1/抖音/db`) | 持久化配置、同步记录 |
|
||||
| 数据库文件 | `/app/mp3` | 映射到本地稳定目录(如 `/volume1/抖音/mp3`) | 图文视频自定义音频(用于原视频音频带版权的情况) |
|
||||
|
||||
> ✅ **关键注意**:
|
||||
> 1. 本地路径需与后续后台「抖音授权」页面配置的「文件存储路径」**完全一致**;
|
||||
@@ -93,29 +93,16 @@ Cookie 及 `sec_user_id` 是同步功能的核心,需严格按步骤获取,
|
||||
|
||||
| 镜像标签 | 架构 |
|
||||
| ----------------- | -------------- |
|
||||
| `beta_2.0.0` | x86_64 (amd64) |
|
||||
| `arm_1.9.8` | ARM64 |
|
||||
| `beta_2.0.1` | x86_64 (amd64) |
|
||||
| `arm_2.0.1` | ARM64 |
|
||||
|
||||
|
||||
### 构建命令示例
|
||||
|
||||
将下方命令中的「本地路径」替换为你的实际路径,终端执行即可:
|
||||
|
||||
#### 方式一:Docker 命令行(不推荐)
|
||||
```bash
|
||||
docker run -d --restart=always \
|
||||
-v /opt/dysync/coll:/app/collect \
|
||||
-v /opt/dysync/favorite:/app/favorite \
|
||||
-v /opt/dysync/db:/app/db \
|
||||
-v /opt/dysync/imgs:/app/images \
|
||||
-v /opt/dysync/uper:/app/uper \
|
||||
-p 10101:10101 \
|
||||
--name dysync2026 \
|
||||
ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_2.0.0
|
||||
```
|
||||
|
||||
|
||||
### 方式二:Docker Compose 运行(推荐)
|
||||
### 方式一:Docker Compose 运行(推荐)
|
||||
创建 docker-compose.yml 文件,复制以下内容,替换「本地路径」后执行 docker-compose up -d:
|
||||
|
||||
<span style="color: red; font-weight: bold;">需要注意:unraid玩家需要增加 user配置 --user 1000:100</span>
|
||||
@@ -126,7 +113,7 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
dysync:
|
||||
image: ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_2.0.0
|
||||
image: ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_2.0.1
|
||||
container_name: dysync2026 # 容器名称
|
||||
restart: unless-stopped # 始终重启容器,除非容器被手动停止或Docker服务停止
|
||||
ports:
|
||||
@@ -138,13 +125,11 @@ services:
|
||||
- /vol2/1000/media/dysync/mp3:/app/mp3
|
||||
- /vol2/1000/media/dysync/dy1/coll:/app/collect # 个人收藏视频目录
|
||||
- /vol2/1000/media/dysync/dy1/fav:/app/favorite # 个人喜欢视频目录
|
||||
- /vol2/1000/media/dysync/dy1/imgv:/app/images # 图文视频目录
|
||||
- /vol2/1000/media/dysync/dy1/up:/app/uper # 指定博主视频目录
|
||||
|
||||
# 多账号路径映射示例(可选,需在后台对应账号配置中指定存储路径)
|
||||
- /vol2/1000/media/dysync/dy2/collect:/app/collect2
|
||||
- /vol2/1000/media/dysync/dy2/fav:/app/favorite2
|
||||
- /vol2/1000/media/dysync/dy2/imgv:/app/images2
|
||||
- /vol2/1000/media/dysync/dy2/up:/app/uper2
|
||||
|
||||
network_mode: bridge
|
||||
@@ -155,7 +140,7 @@ services:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 120m #限制内存占用不超过120mb,如果有图文视频下载需求,不建议设置
|
||||
memory: 250m #限制内存占用不超过250mb,如果有图文视频下载需求,不建议设置
|
||||
|
||||
```
|
||||
|
||||
@@ -171,8 +156,6 @@ services:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
@@ -224,6 +207,8 @@ services:
|
||||
|
||||
17. ✅ 完成飞牛fpk打包:https://github.com/jianzhichu/FnDepot
|
||||
|
||||
18. ✅ 合集、短剧、自定义收藏夹下载。
|
||||
|
||||
|
||||
|
||||
# 免责声明
|
||||
|
||||
@@ -34,21 +34,21 @@
|
||||
<div class="form-section">
|
||||
<h3 class="section-title">博主视频</h3>
|
||||
|
||||
<a-form-item has-feedback label="默认规则" name="UperUseViedoTitle" :wrapper-col="{ span: 20 }">
|
||||
<!-- <a-form-item has-feedback label="默认规则" name="UperUseViedoTitle" :wrapper-col="{ span: 20 }">
|
||||
<a-switch v-model:checked="formState.UperUseViedoTitle" />
|
||||
<div class="flex items-start mt-1 text-sm text-gray-500">
|
||||
<InfoCircleOutlined class="text-blue-400 mr-1 mt-0.5" />
|
||||
<span>开启后,将使用原标题作为文件名,未开启且未设置标题规则模板,则默认用视频id命名</span>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form-item> -->
|
||||
|
||||
<a-form-item has-feedback label="统一存储" name="UperSaveTogether" :wrapper-col="{ span: 20 }">
|
||||
<!-- <a-form-item has-feedback label="统一存储" name="UperSaveTogether" :wrapper-col="{ span: 20 }">
|
||||
<a-switch v-model:checked="formState.UperSaveTogether" />
|
||||
<div class="flex items-start mt-1 text-sm text-gray-500">
|
||||
<InfoCircleOutlined class="text-blue-400 mr-1 mt-0.5" />
|
||||
<span>开启后,所有博主视频直接都存一个根目录;关闭后,按博主名称创建文件夹单独存储。</span>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form-item> -->
|
||||
|
||||
<!-- 模板相关配置:只有关闭"标题当文件名"时才显示 -->
|
||||
<a-form-item has-feedback label="标题模板" name="FollowedTitleTemplate" :wrapper-col="{ span: 12 }" v-if="!formState.UperUseViedoTitle">
|
||||
@@ -57,7 +57,7 @@
|
||||
<p></p>
|
||||
<InfoCircleOutlined class="text-blue-400 mr-1 mt-0.5" />
|
||||
<span style="color: red">
|
||||
请选择文件名占位符和模板分隔符(文件名命名规则配置仅博主视频有效)
|
||||
请选择文件名占位符和模板分隔符(文件名命名规则配置仅博主视频有效,不配置默认使用视频id作为文件名)
|
||||
</span>
|
||||
</div>
|
||||
</a-form-item>
|
||||
@@ -299,7 +299,7 @@ interface FormState {
|
||||
Id: string;
|
||||
BatchCount: number;
|
||||
DownImageVideo: boolean;
|
||||
UperSaveTogether: boolean;
|
||||
//UperSaveTogether: boolean;
|
||||
UperUseViedoTitle: boolean;
|
||||
LogKeepDay: number;
|
||||
DownImage: boolean;
|
||||
@@ -323,7 +323,7 @@ const formState: UnwrapRef<FormState> = reactive({
|
||||
BatchCount: 10,
|
||||
LogKeepDay: 10,
|
||||
UperUseViedoTitle: false,
|
||||
UperSaveTogether: false,
|
||||
// UperSaveTogether: false,
|
||||
DownImageVideo: false,
|
||||
DownMp3: false,
|
||||
DownImage: false,
|
||||
@@ -396,7 +396,7 @@ const getConfig = () => {
|
||||
BatchCount: res.data.batchCount,
|
||||
DownImageVideo: res.data.downImageVideo,
|
||||
UperUseViedoTitle: res.data.uperUseViedoTitle,
|
||||
UperSaveTogether: res.data.uperSaveTogether,
|
||||
// UperSaveTogether: res.data.uperSaveTogether,
|
||||
LogKeepDay: res.data.logKeepDay,
|
||||
DownImage: res.data.downImage,
|
||||
DownMp3: res.data.downMp3,
|
||||
|
||||
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 419 KiB After Width: | Height: | Size: 185 KiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 218 KiB After Width: | Height: | Size: 162 KiB |
@@ -129,7 +129,7 @@
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- 核心配置:仅用核心版本号1.9.8,自动拼接前缀 -->
|
||||
<!-- 核心配置:仅用核心版本号2.0.1,自动拼接前缀 -->
|
||||
<!--<Target Name="DockerBuildAndPushAfterPublish" AfterTargets="Publish">
|
||||
<Exec Command="docker build -t jianzhichu/dysync.net:beta_$(DockerCoreVersion) . && docker tag jianzhichu/dysync.net:beta_$(DockerCoreVersion) ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_$(DockerCoreVersion) && docker push ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_$(DockerCoreVersion)"
|
||||
Condition="'$(DockerArch)' == 'x86'" />
|
||||
|
||||
@@ -36,17 +36,17 @@ namespace dy.net.job
|
||||
return await douyinHttpClientService.SyncCollectVideos(cursor, count, cookie.Cookies);
|
||||
}
|
||||
|
||||
protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed = null)
|
||||
{
|
||||
return data != null && data.HasMore == 1 && cookie.CollHasSyncd == 0;
|
||||
}
|
||||
//protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed , AppConfig config)
|
||||
//{
|
||||
// return data != null && data.HasMore == 1 && cookie.CollHasSyncd == 0;
|
||||
//}
|
||||
|
||||
protected override async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount,DouyinFollowed followed,DouyinCollectCate cate)
|
||||
{
|
||||
cookie.CollHasSyncd = 1;
|
||||
await douyinCookieService.UpdateAsync(cookie);
|
||||
Log.Debug($"[{VideoType}]-[{cookie.UserName}],本次成功同步{syncCount}条视频");
|
||||
}
|
||||
//protected override async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount,DouyinFollowed followed,DouyinCollectCate cate)
|
||||
//{
|
||||
// cookie.CollHasSyncd = 1;
|
||||
// await douyinCookieService.UpdateAsync(cookie);
|
||||
// Log.Debug($"[{VideoType}]-[{cookie.UserName}],本次成功同步{syncCount}条视频");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,18 +30,18 @@ namespace dy.net.job
|
||||
return await douyinHttpClientService.SyncFavoriteVideos(count, cursor, cookie.SecUserId, cookie.Cookies);
|
||||
}
|
||||
|
||||
protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed=null)
|
||||
{
|
||||
return data != null && data.HasMore == 1 && cookie.FavHasSyncd == 0;
|
||||
}
|
||||
//protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed, AppConfig config)
|
||||
//{
|
||||
// return data != null && data.HasMore == 1;
|
||||
//}
|
||||
|
||||
|
||||
protected override async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount, DouyinFollowed followed,DouyinCollectCate cate)
|
||||
{
|
||||
cookie.FavHasSyncd = 1;
|
||||
await douyinCookieService.UpdateAsync(cookie);
|
||||
await base.HandleSyncCompletion(cookie, syncCount, followed, cate);
|
||||
}
|
||||
//protected override async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount, DouyinFollowed followed,DouyinCollectCate cate)
|
||||
//{
|
||||
// cookie.FavHasSyncd = 1;
|
||||
// await douyinCookieService.UpdateAsync(cookie);
|
||||
// await base.HandleSyncCompletion(cookie, syncCount, followed, cate);
|
||||
//}
|
||||
|
||||
protected override string CreateSaveFolder(DouyinCookie cookie, Aweme item, AppConfig config, DouyinFollowed followed,DouyinCollectCate cate)
|
||||
{
|
||||
|
||||
@@ -62,15 +62,15 @@ namespace dy.net.job
|
||||
#region 私有字段
|
||||
|
||||
// 类级别静态字段:映射视频类型与同步完成状态判断逻辑(复用+易维护)
|
||||
private static readonly Dictionary<VideoTypeEnum, Func<DouyinCookie, bool>> _syncStatusCheckMap = new()
|
||||
{
|
||||
[VideoTypeEnum.dy_favorite] = cookie => cookie.FavHasSyncd == 1,
|
||||
[VideoTypeEnum.dy_collects] = cookie => cookie.CollHasSyncd == 1,
|
||||
[VideoTypeEnum.dy_follows] = cookie => cookie.UperSyncd == 1,
|
||||
[VideoTypeEnum.ImageVideo] = cookie => cookie.UperSyncd == 1
|
||||
&& cookie.CollHasSyncd == 1
|
||||
&& cookie.FavHasSyncd == 1
|
||||
};
|
||||
//private static readonly Dictionary<VideoTypeEnum, Func<DouyinCookie, bool>> _syncStatusCheckMap = new()
|
||||
//{
|
||||
// [VideoTypeEnum.dy_favorite] = cookie => cookie.FavHasSyncd == 1,
|
||||
// [VideoTypeEnum.dy_collects] = cookie => cookie.CollHasSyncd == 1,
|
||||
// [VideoTypeEnum.dy_follows] = cookie => cookie.UperSyncd == 1,
|
||||
// [VideoTypeEnum.ImageVideo] = cookie => cookie.UperSyncd == 1
|
||||
// && cookie.CollHasSyncd == 1
|
||||
// && cookie.FavHasSyncd == 1
|
||||
//};
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -180,14 +180,16 @@ namespace dy.net.job
|
||||
/// <returns>视频信息对象,包含视频列表和分页信息</returns>
|
||||
protected abstract Task<DouyinVideoInfoResponse> FetchVideoData(DouyinCookie cookie, string cursor, DouyinFollowed followed, DouyinCollectCate cate);
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否应该继续同步下一页数据
|
||||
/// </summary>
|
||||
/// <param name="cookie">用户Cookie</param>
|
||||
/// <param name="data">当前获取到的视频数据</param>
|
||||
/// <param name="followed">关注博主</param>
|
||||
/// <returns>如果应该继续同步,则为true;否则为false</returns>
|
||||
protected abstract bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed);
|
||||
///// <summary>
|
||||
///// 判断是否应该继续同步下一页数据
|
||||
///// </summary>
|
||||
///// <param name="cookie">用户Cookie</param>
|
||||
///// <param name="data">当前获取到的视频数据</param>
|
||||
///// <param name="followed">关注博主</param>
|
||||
///// <returns>如果应该继续同步,则为true;否则为false</returns>
|
||||
//protected bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed, AppConfig config) {
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 获取下一页数据的游标
|
||||
@@ -258,7 +260,7 @@ namespace dy.net.job
|
||||
/// <param name="followed"></param>
|
||||
/// <param name="cate"></param>
|
||||
/// <returns>一个表示异步操作的任务</returns>
|
||||
protected virtual async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount, DouyinFollowed followed = null,DouyinCollectCate cate=null)
|
||||
protected async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount, DouyinFollowed followed = null,DouyinCollectCate cate=null)
|
||||
{
|
||||
var tag = cate?.Name ?? followed?.UperName ?? string.Empty;
|
||||
tag = !string.IsNullOrWhiteSpace(tag) ? $"-[{tag}]" : tag;
|
||||
@@ -392,11 +394,13 @@ namespace dy.net.job
|
||||
break;
|
||||
}
|
||||
// 判断是否还有更多数据
|
||||
hasMore = ShouldContinueSync(cookie, data, followed);
|
||||
//hasMore = ShouldContinueSync(cookie, data, followed, config);
|
||||
|
||||
// 获取下一页游标
|
||||
cursor = GetNextCursor(data);
|
||||
|
||||
hasMore = data.HasMore == 1;
|
||||
|
||||
// 处理视频列表
|
||||
(List<DouyinVideo> videos,int syncCountx) = await ProcessVideoList(syncCount,cookie, data, config, followed, cate);
|
||||
if(videos != null && videos.Any())
|
||||
@@ -407,8 +411,7 @@ namespace dy.net.job
|
||||
|
||||
syncCount += syncCountx;
|
||||
|
||||
// 检查批次上限,若满足条件则终止循环(核心优化:抽离为方法)
|
||||
if (IsSyncLimitReached(cookie, config, syncCount,cate))
|
||||
if (IsSyncLimitReached(cookie, config, syncCount,cate,followed))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -426,8 +429,10 @@ namespace dy.net.job
|
||||
/// <param name="cookie">抖音Cookie</param>
|
||||
/// <param name="config">同步配置</param>
|
||||
/// <param name="syncCount">已同步数量</param>
|
||||
/// <param name="cate"></param>
|
||||
/// <param name="followed"></param>
|
||||
/// <returns>是否需要终止循环</returns>
|
||||
private bool IsSyncLimitReached(DouyinCookie cookie, AppConfig config, int syncCount,DouyinCollectCate cate)
|
||||
private bool IsSyncLimitReached(DouyinCookie cookie, AppConfig config, int syncCount,DouyinCollectCate cate,DouyinFollowed followed)
|
||||
{
|
||||
if(cate!=null && cate.CateType != VideoTypeEnum.dy_custom_collect)
|
||||
{
|
||||
@@ -447,23 +452,25 @@ namespace dy.net.job
|
||||
}
|
||||
|
||||
}
|
||||
if (VideoType == VideoTypeEnum.dy_collects || VideoType == VideoTypeEnum.dy_favorite)
|
||||
return config.OnlySyncNew;
|
||||
|
||||
return VideoType == VideoTypeEnum.dy_follows && !followed.FullSync;
|
||||
|
||||
// 获取当前视频类型对应的状态判断逻辑
|
||||
if (!_syncStatusCheckMap.TryGetValue(VideoType, out var isSyncCompleted))
|
||||
{
|
||||
//Log.Debug($"[{VideoType.GetVideoTypeDesc()}]无匹配的同步状态判断规则,不终止循环");
|
||||
return false;
|
||||
}
|
||||
//// 获取当前视频类型对应的状态判断逻辑
|
||||
//if (!_syncStatusCheckMap.TryGetValue(VideoType, out var isSyncCompleted))
|
||||
//{
|
||||
// //Log.Debug($"[{VideoType.GetVideoTypeDesc()}]无匹配的同步状态判断规则,不终止循环");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// 状态满足则记录日志并返回「终止循环」
|
||||
if (isSyncCompleted.Invoke(cookie))
|
||||
{
|
||||
Log.Debug($"[{VideoType.GetDesc()}][{cookie.UserName}]本次同步达到上限{config.BatchCount},停止同步!!!");
|
||||
return true;
|
||||
}
|
||||
//// 状态满足则记录日志并返回「终止循环」
|
||||
//if (isSyncCompleted.Invoke(cookie))
|
||||
//{
|
||||
// Log.Debug($"[{VideoType.GetDesc()}][{cookie.UserName}]本次同步达到上限{config.BatchCount},停止同步!!!");
|
||||
// return true;
|
||||
//}
|
||||
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 遍历视频列表,分别处理每个视频和图片集
|
||||
@@ -1334,7 +1341,7 @@ namespace dy.net.job
|
||||
AuthorAvatarUrl = item.Author.AvatarLarger?.UrlList?.FirstOrDefault() ?? item.Author.AvatarThumb?.UrlList?.FirstOrDefault(),
|
||||
CreateTime = DateTimeUtil.Convert10BitTimestamp(item.CreateTime),
|
||||
VideoTitle = string.IsNullOrWhiteSpace(item.Desc) ? $"{item.Author?.Nickname}-{item.CreateTime}" : item.Desc,
|
||||
VideoTitleSimplify = VideoType == VideoTypeEnum.dy_follows? GetVideoSimplifyTitle(item):string.Empty,
|
||||
//VideoTitleSimplify = VideoType == VideoTypeEnum.dy_follows? GetVideoSimplifyTitle(item):string.Empty,
|
||||
Id = IdGener.GetLong().ToString(),
|
||||
Resolution = $"{bitRate.PlayAddr.Width}×{bitRate.PlayAddr.Height}",
|
||||
FileSize = bitRate.PlayAddr.DataSize,
|
||||
@@ -1371,17 +1378,17 @@ namespace dy.net.job
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
private string GetVideoSimplifyTitle(Aweme item)
|
||||
{
|
||||
var config = douyinCommonService.GetConfig();
|
||||
string simplifiedTitle = string.Empty;
|
||||
//private string GetVideoSimplifyTitle(Aweme item)
|
||||
//{
|
||||
// var config = douyinCommonService.GetConfig();
|
||||
// string simplifiedTitle = string.Empty;
|
||||
|
||||
if (config?.UperUseViedoTitle ?? false)
|
||||
{
|
||||
simplifiedTitle = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId);
|
||||
}
|
||||
return simplifiedTitle;
|
||||
}
|
||||
// if (config?.UperUseViedoTitle ?? false)
|
||||
// {
|
||||
// simplifiedTitle = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId);
|
||||
// }
|
||||
// return simplifiedTitle;
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ namespace dy.net.job
|
||||
return await douyinHttpClientService.SyncCollectVideosByCollectId(cursor,count,cookie.Cookies,cate.XId);
|
||||
}
|
||||
|
||||
protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed = null)
|
||||
{
|
||||
return data != null && data.HasMore == 1;
|
||||
}
|
||||
//protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed = null)
|
||||
//{
|
||||
// return data != null && data.HasMore == 1;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,10 @@ namespace dy.net.job
|
||||
return await douyinHttpClientService.SyncUpderPostVideos(count, cursor, followed.SecUid, cookie.Cookies);
|
||||
}
|
||||
|
||||
protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed)
|
||||
{
|
||||
return data != null && data.HasMore == 1 && cookie.UperSyncd == 0 && followed.FullSync;
|
||||
}
|
||||
//protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed,AppConfig config)
|
||||
//{
|
||||
// return data != null && data.HasMore == 1 && cookie.UperSyncd == 0 && followed.FullSync;
|
||||
//}
|
||||
protected override string GetAuthorAvatarBasePath(DouyinCookie cookie)
|
||||
{
|
||||
return Path.Combine(cookie.UpSavePath, "author");
|
||||
@@ -104,14 +104,14 @@ namespace dy.net.job
|
||||
|
||||
|
||||
string fileName;
|
||||
if (config?.UperUseViedoTitle ?? false)//优先
|
||||
{
|
||||
var sampleName = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId);
|
||||
var (existingName, _) = douyinVideoService.GetUperLastViedoFileName(item.Author.Uid, sampleName);
|
||||
fileName = string.IsNullOrWhiteSpace(existingName) ? $"{sampleName}.{Format}" : $"{existingName}.{Format}";
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (config?.UperUseViedoTitle ?? false)//优先
|
||||
//{
|
||||
// var sampleName = DouyinFileNameHelper.SanitizeLinuxFileName(item.Desc, item.AwemeId);
|
||||
// var (existingName, _) = douyinVideoService.GetUperLastViedoFileName(item.Author.Uid, sampleName);
|
||||
// fileName = string.IsNullOrWhiteSpace(existingName) ? $"{sampleName}.{Format}" : $"{existingName}.{Format}";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(config.FullFollowedTitleTemplate))
|
||||
{
|
||||
@@ -131,7 +131,7 @@ namespace dy.net.job
|
||||
{
|
||||
fileName = $"{item.AwemeId}.{Format}";
|
||||
}
|
||||
}
|
||||
//}
|
||||
return fileName;
|
||||
|
||||
}
|
||||
@@ -151,12 +151,12 @@ namespace dy.net.job
|
||||
return base.GetNfoFileName(cookie, item, config, imageType, cate);
|
||||
}
|
||||
|
||||
protected override async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
{
|
||||
cookie.UperSyncd = 1;
|
||||
await douyinCookieService.UpdateAsync(cookie);
|
||||
await base.HandleSyncCompletion(cookie, syncCount, followed, cate);
|
||||
}
|
||||
//protected override async Task HandleSyncCompletion(DouyinCookie cookie, int syncCount, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
//{
|
||||
// cookie.UperSyncd = 1;
|
||||
// await douyinCookieService.UpdateAsync(cookie);
|
||||
// await base.HandleSyncCompletion(cookie, syncCount, followed, cate);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace dy.net.job
|
||||
if (data.Followings?.Any() == true)
|
||||
{
|
||||
followList.AddRange(data.Followings);
|
||||
Log.Debug($"[{cookie.UserName}] - {LOG_TAG_FOLLOW}:获取{data.Followings.Count}条,累计{followList.Count}条");
|
||||
//Log.Debug($"[{cookie.UserName}] - {LOG_TAG_FOLLOW}:获取{data.Followings.Count}条,累计{followList.Count}条");
|
||||
}
|
||||
|
||||
if (!config.IsFirstRunning) hasMore = false;
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace dy.net.job
|
||||
return await douyinHttpClientService.SyncMixViedosByMixId(cursor,count,cookie.Cookies,cate.XId);
|
||||
}
|
||||
|
||||
protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed=null)
|
||||
{
|
||||
return data != null && data.HasMore == 1;
|
||||
}
|
||||
//protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed=null)
|
||||
//{
|
||||
// return data != null && data.HasMore == 1;
|
||||
//}
|
||||
protected override string CreateSaveFolder(DouyinCookie cookie, Aweme item, AppConfig config, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
{
|
||||
if (cate != null)
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace dy.net.job
|
||||
return await douyinHttpClientService.SyncSeriesViedosByMSeriesId(cursor, count, cookie.Cookies,cate.XId);
|
||||
}
|
||||
|
||||
protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed=null)
|
||||
{
|
||||
return data != null && data.HasMore == 1;
|
||||
}
|
||||
//protected override bool ShouldContinueSync(DouyinCookie cookie, DouyinVideoInfoResponse data, DouyinFollowed followed=null)
|
||||
//{
|
||||
// return data != null && data.HasMore == 1;
|
||||
//}
|
||||
|
||||
protected override string CreateSaveFolder(DouyinCookie cookie, Aweme item, AppConfig config, DouyinFollowed followed, DouyinCollectCate cate)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace dy.net.model.entity
|
||||
/// <summary>
|
||||
/// 博主视频是否 直接用标题做文件名
|
||||
/// </summary>
|
||||
public bool UperUseViedoTitle { get; set; }
|
||||
//public bool UperUseViedoTitle { get; set; }
|
||||
/// <summary>
|
||||
/// 是否博主视频直接放一个根目录,不另外按名字建文件夹
|
||||
/// </summary>
|
||||
|
||||
@@ -75,9 +75,9 @@ namespace dy.net.model.entity
|
||||
/// 如果是0,则同步时会获取全部数据;如果是1,则同步时只获取最新的数据(也就是只查一次)
|
||||
/// 接口可以将该值改为0,下次开始同步就会重新获取全部数据
|
||||
/// </summary>
|
||||
public int CollHasSyncd { get; set; }
|
||||
public int FavHasSyncd { get; set; }
|
||||
public int UperSyncd { get; set; }
|
||||
//public int CollHasSyncd { get; set; }
|
||||
//public int FavHasSyncd { get; set; }
|
||||
//public int UperSyncd { get; set; }
|
||||
/// <summary>
|
||||
/// 关注的用户sec_user_id列表 json字符串存储
|
||||
/// </summary>
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace dy.net.service
|
||||
BatchCount = 18,
|
||||
LogKeepDay = 7,
|
||||
//UperSaveTogether = false,//博主视频:true-->每个视频单独一个文件夹 false-->所有视频放在同一个文件夹
|
||||
UperUseViedoTitle = false,//博主视频:true-->使用视频标题作为文件名 false-->使用视频id作为文件名
|
||||
//UperUseViedoTitle = false,//博主视频:true-->使用视频标题作为文件名 false-->使用视频id作为文件名
|
||||
DownImageVideo = true,//默认下载图文视频
|
||||
DownMp3 = false,
|
||||
DownImage = false,
|
||||
@@ -111,18 +111,18 @@ namespace dy.net.service
|
||||
/// 重置所有Cookie的同步状态为0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool UpdateAllCookieSyncedToZero()
|
||||
{
|
||||
//public bool UpdateAllCookieSyncedToZero()
|
||||
//{
|
||||
|
||||
var cookies = sqlSugarClient.Queryable<DouyinCookie>().ToList();
|
||||
foreach (var cookie in cookies)
|
||||
{
|
||||
cookie.CollHasSyncd = 0;
|
||||
cookie.FavHasSyncd = 0;
|
||||
cookie.UperSyncd = 0;
|
||||
}
|
||||
return sqlSugarClient.Updateable(cookies).ExecuteCommand() > 0;
|
||||
}
|
||||
// var cookies = sqlSugarClient.Queryable<DouyinCookie>().ToList();
|
||||
// foreach (var cookie in cookies)
|
||||
// {
|
||||
// cookie.CollHasSyncd = 0;
|
||||
// cookie.FavHasSyncd = 0;
|
||||
// cookie.UperSyncd = 0;
|
||||
// }
|
||||
// return sqlSugarClient.Updateable(cookies).ExecuteCommand() > 0;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 查询是否已删除
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace dy.net.service
|
||||
FavSavePath = "/app/favorite",
|
||||
UpSavePath = "/app/uper",
|
||||
//ImgSavePath="/app/images",
|
||||
CollHasSyncd = 0,
|
||||
FavHasSyncd = 0,
|
||||
UperSyncd = 0,
|
||||
//CollHasSyncd = 0,
|
||||
//FavHasSyncd = 0,
|
||||
//UperSyncd = 0,
|
||||
MyUserId=""
|
||||
};
|
||||
return _cookieRepository.Insert(cookie);
|
||||
@@ -111,19 +111,19 @@ namespace dy.net.service
|
||||
/// 将所有同步类型的同步状态改为已同步,这样,之后就不会再扫描所有接口数据,只会读取最新一页的数据了
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> SetOnlySyncNew()
|
||||
{
|
||||
var cks= await _cookieRepository.GetAllAsync();
|
||||
//public async Task<bool> SetOnlySyncNew()
|
||||
//{
|
||||
// var cks= await _cookieRepository.GetAllAsync();
|
||||
|
||||
foreach (var item in cks)
|
||||
{
|
||||
item.CollHasSyncd = 1;
|
||||
item.FavHasSyncd = 1;
|
||||
item.UperSyncd = 1;
|
||||
}
|
||||
var d= await _cookieRepository.UpdateRangeAsync(cks);
|
||||
return d>0;
|
||||
}
|
||||
// foreach (var item in cks)
|
||||
// {
|
||||
// item.CollHasSyncd = 1;
|
||||
// item.FavHasSyncd = 1;
|
||||
// item.UperSyncd = 1;
|
||||
// }
|
||||
// var d= await _cookieRepository.UpdateRangeAsync(cks);
|
||||
// return d>0;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +99,9 @@ namespace dy.net.service
|
||||
/// 启动所有抖音相关定时任务(所有任务独立执行)
|
||||
/// </summary>
|
||||
/// <param name="expression">Cron表达式或间隔分钟数(所有任务使用相同的执行频率)</param>
|
||||
/// <param name="isRestart"></param>
|
||||
/// <returns>是否启动成功</returns>
|
||||
public async Task<bool> InitOrReStartAllJobs(string expression)
|
||||
public async Task<bool> InitOrReStartAllJobs(string expression,bool isRestart=false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(expression))
|
||||
{
|
||||
@@ -116,13 +117,15 @@ namespace dy.net.service
|
||||
await RemoveAllExistingJobs(scheduler);
|
||||
|
||||
// 遍历启动所有任务(独立执行,无顺序依赖)
|
||||
var allJobKeys = JobConfigs.Keys.Where(k => k != "follow_user_once").ToList(); // 排除单次执行的任务
|
||||
foreach (var jobKey in allJobKeys)
|
||||
// 统一生成任务列表
|
||||
var jobKeys = isRestart
|
||||
? JobConfigs.Keys.Where(k => k != "follow_user_once").ToList()
|
||||
: JobConfigs.Keys.Where(k => k != "follow_user_once" && k != "follow_user").ToList();
|
||||
|
||||
// 执行任务启动逻辑
|
||||
foreach (var jobKey in jobKeys)
|
||||
{
|
||||
if (jobKey == "follow_user")
|
||||
{
|
||||
expression = "60";
|
||||
}
|
||||
if (jobKey == "follow_user") expression = "60";
|
||||
var startSuccess = await StartJobAsync(jobKey, expression);
|
||||
if (startSuccess)
|
||||
{
|
||||
@@ -133,8 +136,16 @@ namespace dy.net.service
|
||||
Log.Error($"启动任务失败:{jobKey}");
|
||||
}
|
||||
}
|
||||
// 补充日志和单次任务
|
||||
if (isRestart)
|
||||
{
|
||||
Log.Information($"共启动 {jobKeys.Count} 个定时任务");
|
||||
}
|
||||
else
|
||||
{
|
||||
await StartOneTimeJobAsync("follow_user_once");
|
||||
}
|
||||
|
||||
Log.Information($"共启动 {allJobKeys.Count} 个定时任务,执行频率:{expression}");
|
||||
|
||||
//await StartJobAsync(VideoTypeEnum.dy_custom_collect.GetDesc(), expression);
|
||||
|
||||
|
||||
@@ -328,39 +328,39 @@ namespace dy.net.service
|
||||
}
|
||||
}
|
||||
|
||||
var CookieIds = reDownList.Select(x => x.CookieId).Distinct();
|
||||
foreach (var ck in CookieIds)
|
||||
{
|
||||
var cookie = douyinCookieRepository.GetById(ck);
|
||||
if (cookie == null)
|
||||
continue;
|
||||
var viedoTypes = videos.Where(x => x.CookieId == ck).Select(x => x.ViedoType).Distinct();
|
||||
//var CookieIds = reDownList.Select(x => x.CookieId).Distinct();
|
||||
//foreach (var ck in CookieIds)
|
||||
//{
|
||||
// var cookie = douyinCookieRepository.GetById(ck);
|
||||
// if (cookie == null)
|
||||
// continue;
|
||||
// var viedoTypes = videos.Where(x => x.CookieId == ck).Select(x => x.ViedoType).Distinct();
|
||||
|
||||
if (viedoTypes != null && viedoTypes.Any())
|
||||
{
|
||||
foreach (VideoTypeEnum item in viedoTypes)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case VideoTypeEnum.dy_favorite:
|
||||
cookie.FavHasSyncd = 0;
|
||||
break;
|
||||
case VideoTypeEnum.dy_collects:
|
||||
cookie.CollHasSyncd = 0;
|
||||
break;
|
||||
case VideoTypeEnum.dy_follows:
|
||||
cookie.UperSyncd = 0;
|
||||
break;
|
||||
case VideoTypeEnum.ImageVideo:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
await douyinCookieRepository.UpdateAsync(cookie);
|
||||
// //if (viedoTypes != null && viedoTypes.Any())
|
||||
// //{
|
||||
// // foreach (VideoTypeEnum item in viedoTypes)
|
||||
// // {
|
||||
// // switch (item)
|
||||
// // {
|
||||
// // case VideoTypeEnum.dy_favorite:
|
||||
// // cookie.FavHasSyncd = 0;
|
||||
// // break;
|
||||
// // case VideoTypeEnum.dy_collects:
|
||||
// // cookie.CollHasSyncd = 0;
|
||||
// // break;
|
||||
// // case VideoTypeEnum.dy_follows:
|
||||
// // cookie.UperSyncd = 0;
|
||||
// // break;
|
||||
// // case VideoTypeEnum.ImageVideo:
|
||||
// // break;
|
||||
// // default:
|
||||
// // break;
|
||||
// // }
|
||||
// // }
|
||||
// //}
|
||||
// await douyinCookieRepository.UpdateAsync(cookie);
|
||||
|
||||
}
|
||||
//}
|
||||
if (!forever)
|
||||
Serilog.Log.Debug("重新下载视频流程执行完成:成功创建{0}条重新下载记录,删除{1}个文件,等待重新下载...", reDownList.Count, filePathsToDelete.Count);
|
||||
return true;
|
||||
|
||||