fv-cli 0.0.3

dotnet tool install --global fv-cli --version 0.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local fv-cli --version 0.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=fv-cli&version=0.0.3
                    
nuke :add-package fv-cli --version 0.0.3
                    

FV.CLI — 命令行工具文档

[中文] | English

fv 是抖音内容批量下载的命令行工具,支持视频、图文、音乐、合集等类型。

安装:

dotnet tool install -g fv-cli

更新:

dotnet tool update -g fv-cli

源码开发场景:将以下示例中的 fv 替换为 dotnet run --(在 src/FV.CLI 目录下执行)。


前置条件

必需

工具 说明 获取地址
.NET 10 SDK 运行时(已安装 fv global tool 则不需要 SDK) https://dot.net/download

可选(兜底下载)

工具 作用 获取地址
yt-dlp API 接口失败时的兜底下载器,强烈建议安装 https://github.com/yt-dlp/yt-dlp/releases
ffmpeg 视频合并/转码(部分视频 API 返回分段流时需要) https://ffmpeg.org/download.html

安装后需确保 yt-dlpffmpeg 命令在系统 PATH 中可被访问:

yt-dlp --version
ffmpeg -version

yt-dlp 和 ffmpeg 不是必须的。不安装时,若抖音 API 直链可正常获取,下载依然可以完成;仅当 API 返回空或失败时,yt-dlp 兜底才会被触发。


第一步:设置 Cookie(必须)

抖音有严格的反爬策略,所有功能均需要有效的登录 Cookie。请在执行任何命令前先完成此步骤。

方式一:手动导出 cookies.txt(推荐)

  1. 安装浏览器扩展 Get cookies.txt LOCALLY
  2. 在浏览器中打开 douyin.com登录账号,随意播放一个视频
  3. 点击扩展图标,导出为 Netscape 格式 .txt 文件(如 E:\cookies.txt

导出后验证有效性:

fv --test --cookies E:\cookies.txt

cookies.txt 中必须包含以下关键字段:

字段 是否必须 说明
ttwid 设备标识
odin_tt 认证令牌
passport_csrf_token CSRF 保护
sessionid 登录会话
msToken 可选 缺失时自动生成随机值

方式二:浏览器自动采集(--fetch-cookies)

工具可自动打开浏览器,引导登录后自动捕获 Cookie,无需手动导出:

# 启动浏览器采集,完成后 Cookie 自动保存到 --cookies 指定路径
fv --fetch-cookies --cookies E:\cookies.txt

此方式依赖本机已安装 Chrome / Edge 浏览器。


快速开始

# 查看帮助(无参数显示 usage)
fv

# 查看版本号
fv --version

# 验证 Cookie 是否有效(完成第一步后先跑这个)
fv --test --cookies E:\cookies.txt

# 解析分享链接,查看作品信息(不下载)
fv -u "https://v.douyin.com/xxx" --cookies E:\cookies.txt

常用命令

查询单个作品详情

fv --aweme 7618409688824155402 --cookies E:\cookies.txt

开启详细日志(-v)

fv -u "https://v.douyin.com/xxx" --cookies E:\cookies.txt -v

下载单个视频

fv -u "https://www.douyin.com/jingxuan?modal_id=7618409688824155402" --cookies E:\cookies.txt --download

批量下载用户主页(最新 50 条)

fv -u "https://www.douyin.com/user/MS4wLjABAAAAxxx" \
   -m post \
   -n post=50 \
   --cookies E:\cookies.txt

增量下载

fv -u "https://www.douyin.com/user/xxx" \
   -m post \
   --increase post \
   --cookies E:\cookies.txt

指定下载目录 + 关闭音乐/封面

fv -u "https://www.douyin.com/user/xxx" \
   -m post -n post=100 \
   -p E:\Videos \
   --no-music --no-cover \
   --cookies E:\cookies.txt

使用 MySQL 数据库

fv -u "https://v.douyin.com/xxx" \
   -m post \
   --db-type mysql \
   --db-conn "Server=127.0.0.1;Port=3306;Database=fv;User=root;Password=123456;" \
   --cookies E:\cookies.txt

诊断模式(打印完整 HTTP 响应,用于排查签名/Cookie 问题)

fv --diagnose --cookies E:\cookies.txt -v
fv --diagnose --aweme 7613822505429503258 --cookies E:\cookies.txt

参数速查

参数 简写 说明
--url <url> -u 分享链接(可重复)
--cookies <file> cookies.txt 路径
--aweme <id> 直接查 awemeId
--test 验证 Cookie
--verbose -v Debug 日志
--version 显示版本号
--download 开启文件下载
--mode <modes> -m post/like/mix/music/collect/collectmix
--number <mode=N> -n 限制数量,0 = 全量
--path <dir> -p 下载目录
--increase <modes> 增量下载
--start-time <date> 起始日期过滤 YYYY-MM-DD
--end-time <date> 截止日期过滤 YYYY-MM-DD
--no-database 不使用 SQLite 去重
--no-cover 不下载封面
--no-music 不下载音乐
--no-json 不保存元数据
--db-type <type> sqlite / mysql / pgsql
--db-conn <conn> 数据库连接串
--diagnose HTTP 诊断模式
--fetch-cookies 浏览器采集 Cookie

发布

独立单文件可执行(无需 .NET 运行时)

# Windows
.\publish.ps1               # 默认 win-x64 → publish\win-x64\fv.exe
.\publish.ps1 -RID linux-x64

# Linux / macOS
./publish.sh linux-x64      # → publish/linux-x64/fv

发布为 dotnet global tool 到 NuGet

# 先将 nuget.org API Key 写入文件(不要提交到 git!)
"oy2xxxxxxxxxxxxxxxxx" | Out-File nuget-api-key.txt -Encoding ascii

# 打包并发布
.\publish-nuget.ps1

# 仅打包不推送
.\publish-nuget.ps1 -SkipPush

发布后用户可通过以下命令安装:

dotnet tool install -g fv-cli
fv --version

修改版本号

编辑 FV.CLI.csproj 中的 <Version> 字段:

<Version>1.0.0</Version>

构建要求

  • .NET 10 SDK(仅编译时需要)
  • yt-dlp(可选,API 失败时的兜底下载器,需在 PATH 中)
  • ffmpeg(可选,视频合并时需要,需在 PATH 中)

免责声明

请在使用本工具前仔细阅读以下声明。下载或使用本工具,即表示您已充分理解并同意以下全部条款。

  1. 仅供学习研究
    本工具仅用于技术研究、学习交流与个人数据管理目的,严禁用于任何商业目的或违法用途。

  2. 合法合规使用
    使用者须自觉遵守中华人民共和国相关法律法规,包括但不限于《网络安全法》《数据安全法》《个人信息保护法》《著作权法》及抖音平台的《用户服务协议》《隐私政策》。

  3. 尊重版权与隐私
    下载内容版权归原作者及平台所有。未经授权,禁止将下载内容用于二次传播、商业变现、剪辑混剪等侵权行为。不得下载或传播涉及他人隐私的内容。

  4. 禁止滥用
    严禁利用本工具大规模抓取平台数据、骚扰创作者、传播违法违规内容,或用于干扰平台正常运营的任何行为。

  5. 账号风险
    使用自动化工具访问抖音可能违反平台服务条款,存在账号被封禁的风险,使用者需自行承担。

  6. 数据安全
    Cookie 等敏感信息仅存储在本地。请勿将 cookies.txt 上传至公开环境(如 GitHub、网盘等)。

  7. 责任豁免
    作者不对因使用本工具导致的账号封禁、数据丢失、法律纠纷或经济损失承担任何责任。

若您不同意上述任何条款,请立即停止使用并删除本工具。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.0.3 156 4/12/2026
0.0.2 126 4/12/2026
0.0.1 125 4/12/2026