feat(monitor): 粘贴视频链接换出博主主页
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

运营手上常常只有一条作品的分享链接,可监控任务认的是主页里的 sec_uid。

- 从整段分享文案里抠链接(链接前后都是字,按行切切不开),短链先展开,
  再从中取作品 id,最后用详情接口换 author.sec_uid
- 一次最多 20 条,串行 + 0.4 秒间隔;单条失败只在那一条上报错,不连累整批
- normalize_aweme 补上 creator_id:哈希拼不出主页地址,顺带让以后入库的
  抖音作品也带主页链接
- 监控页左上角「视频转主页」,支持逐条复制和一键复制全部(http 下没有
  navigator.clipboard,走 execCommand 兜底)
This commit is contained in:
2026-10-23 08:55:26 +08:00
parent 8e398a5ba1
commit 1474e5e3eb
12 changed files with 651 additions and 6 deletions
@@ -1,5 +1,5 @@
import { useState } from 'react'
import { Activity, BellRing, Download, FileText, MessageSquare, Plus } from 'lucide-react'
import { Activity, BellRing, Download, FileText, Link2, MessageSquare, Plus } from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
@@ -18,6 +18,7 @@ import { RunHistory } from './RunHistory'
import { StatTile } from './StatTile'
import { TaskCard } from './TaskCard'
import { TaskEditorDialog } from './TaskEditorDialog'
import { VideoLinkTool } from './VideoLinkTool'
export function MonitorDashboard() {
const { data: overview } = useMonitorOverview()
@@ -31,6 +32,7 @@ export function MonitorDashboard() {
const [selectedTaskId, setSelectedTaskId] = useState<number | null>(null)
const [editorOpen, setEditorOpen] = useState(false)
const [linkToolOpen, setLinkToolOpen] = useState(false)
const [editingTask, setEditingTask] = useState<MonitorTask | null>(null)
const [onlyNew, setOnlyNew] = useState(false)
// 选中的标签。空数组 = 不筛。
@@ -87,10 +89,22 @@ export function MonitorDashboard() {
<span className="font-mono text-xs tracking-wider text-cyber-text-primary">
监控任务
</span>
<Button size="sm" onClick={openCreate}>
<Plus className="w-3 h-3 mr-1" />
新建
</Button>
<div className="flex items-center gap-1">
{/* 手上只有一条作品链接时,先把它的号找出来 —— 建任务要的是主页里的 sec_uid。 */}
<Button
variant="outline"
size="sm"
onClick={() => setLinkToolOpen(true)}
title="粘贴视频链接,换出博主主页"
>
<Link2 className="w-3 h-3 mr-1" />
视频转主页
</Button>
<Button size="sm" onClick={openCreate}>
<Plus className="w-3 h-3 mr-1" />
新建
</Button>
</div>
</div>
<div className="flex-1 overflow-y-auto terminal-scroll space-y-2 pr-1">
@@ -217,6 +231,7 @@ export function MonitorDashboard() {
</div>
<TaskEditorDialog open={editorOpen} onOpenChange={setEditorOpen} task={editingTask} />
<VideoLinkTool open={linkToolOpen} onOpenChange={setLinkToolOpen} />
</div>
)
}