Skip to main content
F

dsh-video-fetch

fred4g4in/dsh-video-fetch

Paste a link in a sidebar page and download the best quality the platform serves: a headless-browser gear picker for watermark-free Douyin streams, yt-dlp everywhere else, and one operation shared with the video_download agent tool. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Install

dsh plugin --profile web add github:fred4g4in/dsh-video-fetch

README

dsh-video-fetch

Paste a video link in a DeepSeek Harness sidebar page, press Download, and the best-quality file lands on disk. The same capability is exposed to the agent as the video_download tool — one Host operation, two entry points.

English | 中文

视频下载
粘贴链接,自动识别平台并取最高画质存档。
┌────────────────────────────────────────────────────────┐
│ [ https://v.douyin.com/xxxx/                         ] │
│ 保存到 [C:\Users\me\Videos                        ] [浏览…][保存] │
│ 画质 [最高画质 ▾]  (抖音)                            [下载] │
└────────────────────────────────────────────────────────┘
● 电视剧重庆号_2160p.mp4            已完成 · 12s
  4590×2160 · hevc · 874kbps · 25fps · 4.7 MB · 0:44
  [打开位置] [复制路径]

Why it exists

Douyin's web endpoints now demand signed cookies (s_v_web_id, uifid, and friends). A plain yt-dlp call against a Douyin link fails with 403 Blocked by ArgusSecurityPlugin Uifid Not Found, and the "水印"/watermark-free stream is not the one the share button points at.

This plugin therefore runs two engines behind one interface:

InputEngine
douyin.com, iesdouyin.com, v.douyin.com short linksHeadless browser opens the page, the aweme/detail response is captured, every bit_rate gear is read, and the watermark-free play_addr of the best gear is downloaded
Bilibili, YouTube, TikTok, Kuaishou, Xiaohongshu, Weibo, X, Instagram, Vimeo, and everything else yt-dlp knowsyt-dlp with bv*+ba/b, merged to mp4, height<=N for quality caps, mp3 for audio

Best quality means highest resolution first, then highest bitrate within it. When a lower-resolution gear carries more than twice the bitrate — a common Douyin "4K" that is really an upscale — the result carries a note instead of silently switching, so quality="1080" stays an explicit choice.

Install

Requires DeepSeek Harness 0.2.1-rc.2 or newer.

git clone https://github.com/fred4g4in/dsh-video-fetch.git

Then install the directory as a local bundle: Plugins → Add plugin → the cloned directory, or programmatically with plugin_manager install_bundle and the absolute path. Changes are live per profile and survive restart.

Python side (one interpreter that has both packages):

python -m pip install -U yt-dlp
python -m pip install -U playwright      # Douyin only; a local Edge/Chrome works too

ffmpeg and ffprobe must be on PATH for merged formats, mp3 extraction, and the measured specs the UI shows.

Usage

Sidebar page. One row of global panel icons gains a 「视频下载」/「Video fetch」 entry. Paste a link, the platform chip resolves as you type, pick a quality ceiling, press download or hit Enter. Running jobs show a progress bar, stage text and elapsed time, and can be cancelled. Finished jobs show measured specs plus Show in folder and Copy path.

Agent. Ask for a link in chat; the model calls video_download:

ParameterMeaning
urlrequired — page URL or share short link
qualitybest (default) / 2160 / 1440 / 1080 / 720 / 540 / audio
diroptional output directory; relative paths resolve against the workspace

Both paths return the same JSON: saved path, platform, title, author, measured resolution/codec/bitrate/fps/duration/size, the engine used, and notes.

Save location. The 「保存到」 row takes a typed path or the folder chooser. The choice is remembered in $DSH_HOME/dsh-video-fetch/settings.json and overrides the outputDir default in the plugin config.

Configuration

Plugin row config (cordis.patch.yml):

KeyDefaultEffect
pythonPath''interpreter path; empty probes python, py -3, python3
outputDir''default save folder; empty uses <workspace>/downloads
cookies''yt-dlp --cookies-from-browser: chrome / edge / firefox / brave
timeoutMinutes20per-download deadline
defaultQualitybestused when a caller passes no quality

Host bridge

The page drives the same operation over same-origin endpoints. Requests are accepted from the loopback host only, and a cross-origin Origin is rejected.

EndpointPurpose
GET /api/video-fetch/infodefaults, quality list, save folder, picker kind (native / browse / false)
POST /api/video-fetch/download{ url, quality? } → job
GET /api/video-fetch/jobsrecent jobs with status, progress, result
POST /api/video-fetch/cancel{ id } → abort the child process
POST /api/video-fetch/reveal{ path } → select the file in the OS file manager
POST /api/video-fetch/dir{ path } → create and remember the save folder
POST /api/video-fetch/pick-dirnative folder chooser (only when the host mounts the native picker)
GET /api/video-fetch/list-dir?path=one level of subfolders (only for the browse picker)
POST /api/video-fetch/mkdir{ path, name } → create a subfolder (only for the browse picker)

Limitations

  • Douyin image posts and live rooms have no downloadable stream; they fail with an explicit message instead of writing an empty file.
  • Sites that gate quality behind a login (Bilibili membership resolutions, Weibo, Instagram) need cookies; without it you get the public gear only.
  • A Douyin "4K" gear is sometimes a low-bitrate upscale. The response notes it; nothing is substituted silently.
  • Signed stream URLs expire, so each download resolves and fetches immediately — there is no offline queue.
  • Concurrent jobs: 3 running, 30 kept in the list.

Development

node --check index.js && node --check client.js
node test/client-smoke.mjs    # client module: dictionaries, main panel, sidebar entry, id agreement
python -m py_compile py/mediadl.py
node test/tool-smoke.mjs      # tool: argument checks, directory resolution, a real download

test/ also holds the harness the sidebar page's registration is checked with; it needs no browser.

License

MIT — see LICENSE.

Related plugins