feat(monitor): 从超级编导按创建时间导入作品链接
超级编导的数据中心里已经有每条分发作品的抖音链接,不用再一条条粘。按 「分发活动创建时间」选一段区间 → 预览作品/博主/播放数据 → 一键建成作品 模式的监控任务,建完默认立刻采一轮,主页信息第一轮就补全。 - 活动列表不支持日期过滤(传了也被静默忽略),只能全量拉下来本地按 created_at 筛;边界按东八区算 —— 容器跑 UTC,按 localtime 会整体错开 8 小时。 - data_center 必须带 video_status=-1,不带默认 0,接口返回空列表。 - share_url 是双斜杠形态,建任务时只取裸作品 id;video_link 的 id 提取 也顺带认双斜杠了。 - 作品模式不拉创作者资料、没有账号快照,组头的主页链接一直出不来。 作品上新增 creator_id(author.sec_uid),优先快照、再用作品兜底。 - token 存设置页(secret),不进仓库。
This commit is contained in:
@@ -637,6 +637,53 @@ class TestDouyinIngest:
|
||||
assert note.published_at == 1790574515 * 1000
|
||||
assert result.notes_fetched == 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_the_sec_uid_lands_on_the_note(self, db, tmp_path):
|
||||
"""作品详情里的 ``author.sec_uid`` 要落到作品上。
|
||||
|
||||
作品模式(以及超级编导导入)**不拉创作者资料**,没有账号快照;博主主页链接
|
||||
只能从这条作品记录里拼出来。丢了它,这类任务里一个主页都点不进去。
|
||||
"""
|
||||
aweme_id = "7525082444551310602"
|
||||
await self._ingest(
|
||||
db, tmp_path, [_dy_note(aweme_id, creator_id="MS4wLjABAAAAtestsuid")]
|
||||
)
|
||||
|
||||
note = await db.scalar(select(MonitorNote))
|
||||
|
||||
assert note.creator_id == "MS4wLjABAAAAtestsuid"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_a_later_run_backfills_a_missing_sec_uid(self, db, tmp_path):
|
||||
"""这条字段是后加的:加之前入库的作品都空着,重采一次就该补上。"""
|
||||
aweme_id = "7525082444551310602"
|
||||
task = await _make_task(db, platform="dy")
|
||||
|
||||
run1 = await _make_run(db, task, started_at=1000)
|
||||
await ingest_run(
|
||||
db,
|
||||
run1,
|
||||
task,
|
||||
_write_run_dir(
|
||||
tmp_path / "run1", [_dy_note(aweme_id)], subdir="douyin"
|
||||
),
|
||||
)
|
||||
|
||||
run2 = await _make_run(db, task, started_at=2000)
|
||||
await ingest_run(
|
||||
db,
|
||||
run2,
|
||||
task,
|
||||
_write_run_dir(
|
||||
tmp_path / "run2",
|
||||
[_dy_note(aweme_id, creator_id="MS4wLjABAAAAtestsuid")],
|
||||
subdir="douyin",
|
||||
),
|
||||
)
|
||||
|
||||
note = await db.scalar(select(MonitorNote))
|
||||
assert note.creator_id == "MS4wLjABAAAAtestsuid"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_timestamps_are_normalised_to_milliseconds(self, db, tmp_path):
|
||||
"""抖音的时间戳是**秒**,小红书是毫秒 —— 差 1000 倍,必须换算。
|
||||
|
||||
Reference in New Issue
Block a user