TikTokDownloader Documentation

TikTok 发布/喜欢/合辑/直播/视频/图集/音乐;抖音发布/喜欢/收藏/收藏夹/视频/图集/实况/直播/音乐/合集/评论/账号/搜索/热榜数据采集工具/下载工具

14,942 stars Python Python 1 file · ~10,249 tokens #abogus#api#csv#docker#douyin#downloader#ffmpeg#httpx
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy TikTokDownloader on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name tiktokdownloader -p 5555:5555 --restart always joeanamier/tiktokdownloader:latest

File: README.md

🔥 **TikTok 发布/喜欢/合辑/直播/视频/图集/音乐;抖音发布/喜欢/收藏/收藏夹/视频/图集/实况/直播/音乐/合集/评论/账号/搜索/热榜数据采集工具:**完全开源,基于 HTTPX 模块实现的免费数据采集和文件下载工具;批量下载抖音账号发布、喜欢、收藏、收藏夹作品;批量下载 TikTok 账号发布、喜欢作品;下载抖音链接或 TikTok 链接作品;获取抖音直播拉流地址;下载抖音直播视频;获取 TikTok 直播拉流地址;下载 TikTok 直播视频;采集抖音作品评论数据;批量下载抖音合集作品;批量下载 TikTok 合辑作品;采集抖音账号详细数据;采集抖音用户 / 作品 / 直播搜索结果;采集抖音热榜数据。
⭐ 本项目历史名称:TikTokDownloader
⚠️ 本项目的加密参数算法已过期失效;为确保项目合法合规,参数算法不再维护,部分功能可能无法正常工作。如需使用,请自行准备加密参数生成代码,配置方法请查阅 文档!


📝 项目功能

功能列表(点击展开)

  • ✅ 下载抖音视频/图集
  • ✅ 下载抖音实况/动图
  • ✅ 下载最高画质视频文件
  • ✅ 下载 TikTok 视频原画
  • ✅ 下载 TikTok 视频/图集
  • ✅ 下载抖音账号发布/喜欢/收藏/收藏夹作品
  • ✅ 下载 TikTok 账号发布/喜欢作品
  • ✅ 采集抖音 / TikTok 详细数据
  • ✅ 批量下载链接作品
  • ✅ 多账号批量下载作品
  • ✅ 自动跳过已下载的文件
  • ✅ 持久化保存采集数据
  • ✅ 支持 CSV/XLSX/SQLite 格式保存数据
  • ✅ 下载动态/静态封面图
  • ✅ 获取抖音直播拉流地址
  • ✅ 获取 TikTok 直播拉流地址
  • ✅ 调用 ffmpeg 下载直播
  • ✅ Web UI 交互界面
  • ✅ 采集抖音作品评论数据
  • ✅ 下载抖音合集作品
  • ✅ 下载 TikTok 合辑作品
  • ✅ 记录点赞收藏等统计数据
  • ✅ 筛选作品发布时间
  • ✅ 支持账号作品增量下载
  • ✅ 支持使用代理采集数据
  • ✅ 支持局域网远程访问
  • ✅ 采集抖音账号详细数据
  • ✅ 作品统计数据更新
  • ✅ 支持自定义账号/合集标识
  • ✅ 自动更新账号昵称/标识
  • ✅ 部署至私有服务器
  • ✅ 部署至公开服务器
  • ✅ 采集抖音搜索数据
  • ✅ 采集抖音热榜数据
  • ✅ 记录已下载作品 ID
  • ☑️ 扫码登陆获取 Cookie
  • ✅ 从浏览器读取 Cookie
  • ✅ 支持 Web API 调用
  • ✅ 支持多线程下载作品
  • ✅ 文件完整性处理机制
  • ✅ 自定义规则筛选作品
  • ✅ 按文件夹归档保存作品文件
  • ✅ 自定义设置文件大小上限
  • ✅ 支持文件断点续传下载
  • ✅ 监听剪贴板链接下载作品
  • 💻 程序截图

    前往 bilibili 观看演示;前往 YouTube 观看演示

    终端交互模式

    建议通过配置文件管理账号,更多介绍请查阅 文档



    Web UI 交互模式

    项目代码已重构,该模式代码尚未更新,未来开发完成重新开放!

    Web API 接口模式


    启动该模式后,访问 http://127.0.0.1:5555/docs 或者 http://127.0.0.1:5555/redoc 可以查阅自动生成的文档!

    API 调用示例代码

    python
    from httpx import post
    from rich import print
    
    
    def demo():
        headers = {"token": ""}
        data = {
            "detail_id": "0123456789",
            "pages": 2,
        }
        api = "http://127.0.0.1:5555/douyin/comment"
        response = post(api, json=data, headers=headers)
        print(response.json())
    
    
    demo()

    📋 项目说明

    快速入门

    ⭐ Mac OS、Windows 10 及以上用户可前往 Releases 或者 Actions 下载已编译的程序,开箱即用!
    ⭐ 本项目包含自动构建可执行文件的 GitHub Actions,使用者可以随时使用 GitHub Actions 将最新源码构建为可执行文件!
    ⭐ 自动构建可执行文件教程请查阅本文档的 构建可执行文件指南 部分;如果需要更加详细的图文教程,请 查阅文章!
    注意:由于 Mac OS 平台的可执行文件 main 未经过代码签名,首次运行时会受到系统安全限制。请先在终端执行 xattr -cr 项目文件夹路径 命令移除安全标记,执行一次后即可正常运行。


    1. **运行可执行文件** 或者 **配置环境运行**(二选一)
        **运行可执行文件**
      1. 下载 [Releases](https://github.com/JoeanAmier/TikTokDownloader/releases/latest) 或者 Actions 构建的可执行文件压缩包
      2. 解压后打开程序文件夹,双击运行 `main`
        **配置环境运行**
      1. 安装不低于 `3.12` 版本的 [Python](https://www.python.org/) 解释器
      2. 下载最新的源码或 [Releases](https://github.com/JoeanAmier/TikTokDownloader/releases/latest) 发布的源码至本地
        1. **使用 pip 安装项目依赖**
        2. 运行 `python -m venv venv` 命令创建虚拟环境(可选)
        3. 运行 `.\venv\Scripts\activate.ps1` 或者 `venv\Scripts\activate` 命令激活虚拟环境(可选)
        4. 运行 `pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt` 命令安装程序所需模块
        5. 运行 `python .\main.py` 或者 `python main.py` 命令启动 DouK-Downloader
          **使用 uv 安装项目依赖(推荐)**
        1. 运行 `uv sync --no-dev` 命令同步环境依赖
        2. 运行 `uv run main.py` 命令启动 DouK-Downloader
    2. 阅读 DouK-Downloader 的免责声明,根据提示输入内容
    3. 将 Cookie 信息写入配置文件
        **手动输入 Cookie**
      1. 参考 [Cookie 提取教程](https://github.com/JoeanAmier/TikTokDownloader/blob/master/docs/Cookie%E8%8E%B7%E5%8F%96%E6%95%99%E7%A8%8B.md),复制所需 Cookie 至剪贴板
      2. 选择 `手动输入 Cookie` 选项,粘贴 Cookie 内容后按照程序提示操作
        **从剪贴板读取 Cookie**
      1. 参考 [Cookie 提取教程](https://github.com/JoeanAmier/TikTokDownloader/blob/master/docs/Cookie%E8%8E%B7%E5%8F%96%E6%95%99%E7%A8%8B.md),复制所需 Cookie 至剪贴板
      2. 选择 `从剪贴板读取 Cookie` 选项,程序会自动读取剪贴板的 Cookie 并写入配置文件
        **从浏览器读取 Cookie(弃用)**
      1. 选择 `从浏览器读取 Cookie` 选项,按照提示输入浏览器类型或序号
        **扫码登录获取 Cookie(失效)**
      1. 选择 `扫码登录获取 Cookie` 选项,程序会显示登录二维码图片,并使用默认应用打开图片
      2. 使用抖音 APP 扫描二维码并登录账号
      3. 按照提示操作,程序会自动将 Cookie 写入配置文件
    4. 返回程序界面,依次选择 `终端交互模式` -> `批量下载链接作品` -> `手动输入待采集的作品链接`
    5. 输入抖音作品链接即可下载作品文件(TikTok 平台需要更多初始设置,详见文档)
    6. 更多详细说明请查看 **[项目文档](https://github.com/JoeanAmier/TikTokDownloader/wiki/Documentation)**
    ⭐ 推荐使用 [Windows 终端](https://learn.microsoft.com/zh-cn/windows/terminal/install)(Windows 11 自带默认终端)

    Docker 容器

    1. 获取镜像
    2. 方式一:使用 `Dockerfile` 文件构建镜像
    3. 方式二:使用 `docker pull joeanamier/tiktok-downloader` 命令拉取镜像
    4. 方式三:使用 `docker pull ghcr.io/joeanamier/tiktok-downloader` 命令拉取镜像
    5. 创建容器:`docker run --name 容器名称(可选) -p 主机端口号:5555 -v tiktok_downloader_volume:/app/Volume -it <镜像名称>`
    6. **注意:**此处的 `<镜像名称>` 需与您在第一步中使用的镜像名称保持一致(例如 `joeanamier/tiktok-downloader` 或 `ghcr.io/joeanamier/tiktok-downloader`)
    7. 运行容器
    8. 启动容器:`docker start -i 容器名称/容器 ID`
    9. 重启容器:`docker restart -i 容器名称/容器 ID`
    Docker 容器无法直接访问宿主机的文件系统,部分功能不可用,例如:`从浏览器读取 Cookie`;其他功能如有异常请反馈!

    点击查看 Cookie 获取教程

    • Cookie 仅需在失效后重新写入配置文件,并非每次运行程序都要写入配置文件!

    • Cookie 会影响下载的视频文件分辨率,如果无法下载最高分辨率的视频文件,请尝试更新 Cookie!

    • 程序获取数据失败时,可以尝试更新 Cookie 或者使用已登录的 Cookie!


    其他说明

  • 本项目内置智能延时请求机制,避免请求频率过高影响平台服务器,如需关闭,请参考 [文档](https://github.com/JoeanAmier/TikTokDownloader/wiki/Documentation#%E9%AB%98%E7%BA%A7%E9%85%8D%E7%BD%AE)
  • 程序提示用户输入时,直接回车代表返回上级菜单,输入 `Q` 或 `q` 代表结束运行
  • 由于获取账号喜欢作品和收藏作品数据仅返回喜欢 / 收藏作品的发布日期,不返回操作日期,因此程序需要获取全部喜欢 / 收藏作品数据再进行日期筛选;如果作品数量较多,可能会花费较长的时间;可通过 `max_pages` 参数控制请求次数
  • 获取私密账号的发布作品数据需要登录后的 Cookie,且登录的账号需要关注该私密账号
  • 批量下载账号作品或合集作品时,如果对应的昵称或标识发生变化,程序会自动更新已下载作品文件名称中的昵称和标识
  • 程序下载文件时会先将文件下载至临时文件夹,下载完成后再移动至储存文件夹;程序运行结束时会清空临时文件夹
  • `批量下载收藏作品模式` 目前仅支持下载当前已登录 Cookie 对应账号的收藏作品,暂不支持多账号
  • 如果需要程序使用代理请求数据,请在配置文件 `settings.json` 设置 `proxy` 参数 (可以考虑使用代理平台: [Swiftproxy](https://www.swiftproxy.net/?ref=TikTokDownloader))
  • 如果您的计算机没有合适的程序编辑 JSON 文件,建议使用 [在线工具](https://www.toolhelper.cn/JSON/JSONFormat) 编辑配置文件内容,修改后需要重启软件才能生效。
  • 当程序请求用户输入内容或链接时,请注意避免输入的内容或链接包含换行符,这可能会导致预期之外的问题
  • 本项目不会支持付费作品下载,请勿反馈任何关于付费作品下载的问题
  • Windows 系统需要以管理员身份运行程序才能读取 Chromium、Chrome、Edge 浏览器 Cookie
  • 本项目并未针对程序多开的情况进行优化,如需程序多开,请复制整个项目的文件夹,避免出现预期之外的问题
  • 程序运行过程中,如需终止程序或 `ffmpeg`,请按下 `Ctrl + C` 终止运行,不要直接点击终端窗口的关闭按钮
  • 构建可执行文件指南

    构建可执行文件指南(点击展开)

    本指南将引导您通过 Fork 本仓库并执行 GitHub Actions 自动完成基于最新源码的程序构建和打包!


    使用步骤

    1. Fork 本仓库

    1. 点击项目仓库右上角的 Fork 按钮,将本仓库 Fork 到您的个人 GitHub 账户中
    2. 您的 Fork 仓库地址将类似于:https://github.com/your-username/this-repo

    2. 启用 GitHub Actions

    1. 前往您 Fork 的仓库页面
    2. 点击顶部的 Settings 选项卡
    3. 点击右侧的 Actions 选项卡
    4. 点击 General 选项
    5. 在 Actions permissions 下,选择 Allow all actions and reusable workflows 选项,点击 Save 按钮

    3. 手动触发打包流程

    1. 在您 Fork 的仓库中,点击顶部的 Actions 选项卡
    2. 找到名为 构建可执行文件 的工作流
    3. 点击右侧的 Run workflow 按钮:
      • 选择 master 或者 develop 分支
      • 点击 Run workflow

    4. 查看打包进度

    1. 在 Actions 页面中,您可以看到触发的工作流运行记录
    2. 点击运行记录,查看详细的日志以了解打包进度和状态

    5. 下载打包结果

    1. 打包完成后,进入对应的运行记录页面
    2. 在页面底部的 Artifacts 部分,您将看到打包的结果文件
    3. 点击下载并保存到本地,即可获得打包好的程序

    注意事项

    1. 资源使用:

      • Actions 的运行环境由 GitHub 免费提供,普通用户每月有一定的免费使用额度(2000 分钟)
    2. 代码修改:

      • 您可以自由修改 Fork 仓库中的代码以定制程序打包流程
      • 修改后重新触发打包流程,您将得到自定义的构建版本
    3. 与主仓库保持同步:

      • 如果主仓库更新了代码或工作流,建议您定期同步 Fork 仓库以获取最新功能和修复

    Actions 常见问题

    Q1: 为什么我无法触发工作流?

    A: 请确认您已按照步骤 启用 Actions,否则 GitHub 会禁止运行工作流

    Q2: 打包流程失败怎么办?

    A:

    • 检查运行日志,了解失败原因
    • 确保代码没有语法错误或依赖问题
    • 如果问题仍未解决,可以在本仓库的 Issues 页面 提出问题

    Q3: 我可以直接使用主仓库的 Actions 吗?

    A: 由于权限限制,您无法直接触发主仓库的 Actions。请通过 Fork 仓库的方式执行打包流程

    程序更新

    **方案一:**下载并解压文件,将旧版本的 _internal\Volume 文件夹复制到新版本的 _internal 文件夹。
    **方案二:**下载并解压文件(不要运行程序),复制全部文件,直接覆盖旧版本文件。

    💝 项目赞助

    Swiftproxy


    接入覆盖全球的 8000万+ 住宅 IP,专为 TikTok / 抖音数据采集与下载优化,Swiftproxy 可有效降低限流与封禁风险,保障下载稳定性与自动轮换。
    优惠码:PROXY90(9折)


    DartNode


    TikHub


    TikHub API 提供超过 700 个端点,可用于从 14+ 个社交媒体平台获取与分析数据 —— 包括视频、用户、评论、商店、商品与趋势等,一站式完成所有数据访问与分析。
    使用 邀请码:ZrdH8McC 注册并充值即可获得 $2 额度。

    🌟 贡献指南

    **欢迎对本项目做出贡献!为了保持代码库的整洁、高效和易于维护,请仔细阅读以下指南,以确保您的贡献能够顺利被接受和整合。**
  • 在开始开发前,请从 `develop` 分支拉取最新的代码,以此为基础进行修改;这有助于避免合并冲突并保证您的改动基于最新的项目状态。
  • 如果您的更改涉及多个不相关的功能或问题,请将它们分成多个独立的提交或拉取请求。
  • 每个拉取请求应尽可能专注于单一功能或修复,以便于代码审查和测试。
  • 遵循现有的代码风格;请确保您的代码与项目中已有的代码风格保持一致;建议使用 Ruff 工具保持代码格式规范。
  • 编写可读性强的代码;添加适当的注释帮助他人理解您的意图。
  • 每个提交都应该包含一个清晰、简洁的提交信息,以描述所做的更改。提交信息应遵循以下格式:`<类型>: <简短描述>`
  • 当您准备提交拉取请求时,请优先将它们提交到 `develop` 分支;这是为了给维护者一个缓冲区,在最终合并到 `master` 分支之前进行额外的测试和审查。
  • 建议在开发前或遇到疑问时与作者沟通,确保开发方向一致,避免重复劳动或无效提交。
  • 参考资料:

  • [贡献者公约](https://www.contributor-covenant.org/zh-cn/version/2/1/code_of_conduct/)
  • [如何为开源做贡献](https://opensource.guide/zh-hans/how-to-contribute/)
  • ♥️ 支持项目

    如果 DouK-Downloader 对您有帮助,请考虑为它点个 Star ⭐,感谢您的支持!

    微信(WeChat) 支付宝(Alipay)

    如果您愿意,可以考虑提供资助为 DouK-Downloader 提供额外的支持!

    ✉️ 联系作者

  • 作者邮箱:[email protected]
  • 作者微信: Downloader_Tools
  • 微信公众号: Downloader Tools
  • **Discord 社区**: [点击加入社区](https://discord.com/invite/ZYtmgKud9Y)
  • QQ 群聊(用于项目交流与摸鱼闲聊): [扫码加入群聊](https://github.com/JoeanAmier/TikTokDownloader/blob/master/docs/QQ%E7%BE%A4%E8%81%8A%E4%BA%8C%E7%BB%B4%E7%A0%81.png)
  • ✨ 作者的其他开源项目:

  • **XHS-Downloader(小红书、XiaoHongShu、RedNote)**:[https://github.com/JoeanAmier/XHS-Downloader](https://github.com/JoeanAmier/XHS-Downloader)
  • **KS-Downloader(快手、KuaiShou)**:[https://github.com/JoeanAmier/KS-Downloader](https://github.com/JoeanAmier/KS-Downloader)
  • ⚠️ 免责声明

    1. 使用者对本项目的使用由使用者自行决定,并自行承担风险。作者对使用者使用本项目所产生的任何损失、责任、或风险概不负责。
    2. 本项目的作者提供的代码和功能是基于现有知识和技术的开发成果。作者按现有技术水平努力确保代码的正确性和安全性,但不保证代码完全没有错误或缺陷。
    3. 本项目依赖的所有第三方库、插件或服务各自遵循其原始开源或商业许可,使用者需自行查阅并遵守相应协议,作者不对第三方组件的稳定性、安全性及合规性承担任何责任。
    4. 使用者在使用本项目时必须严格遵守 GNU General Public License v3.0 的要求,并在适当的地方注明使用了 GNU General Public License v3.0 的代码。
    5. 使用者在使用本项目的代码和功能时,必须自行研究相关法律法规,并确保其使用行为合法合规。任何因违反法律法规而导致的法律责任和风险,均由使用者自行承担。
    6. 使用者不得使用本工具从事任何侵犯知识产权的行为,包括但不限于未经授权下载、传播受版权保护的内容,开发者不参与、不支持、不认可任何非法内容的获取或分发。
    7. 本项目不对使用者涉及的数据收集、存储、传输等处理活动的合规性承担责任。使用者应自行遵守相关法律法规,确保处理行为合法正当;因违规操作导致的法律责任由使用者自行承担。
    8. 使用者在任何情况下均不得将本项目的作者、贡献者或其他相关方与使用者的使用行为联系起来,或要求其对使用者使用本项目所产生的任何损失或损害负责。
    9. 本项目的作者不会提供 DouK-Downloader 项目的付费版本,也不会提供与 DouK-Downloader 项目相关的任何商业服务。
    10. 基于本项目进行的任何二次开发、修改或编译的程序与原创作者无关,原创作者不承担与二次开发行为或其结果相关的任何责任,使用者应自行对因二次开发可能带来的各种情况负全部责任。
    11. 本项目不授予使用者任何专利许可;若使用本项目导致专利纠纷或侵权,使用者自行承担全部风险和责任。未经作者或权利人书面授权,不得使用本项目进行任何商业宣传、推广或再授权。
    12. 作者保留随时终止向任何违反本声明的使用者提供服务的权利,并可能要求其销毁已获取的代码及衍生作品。
    13. 作者保留在不另行通知的情况下更新本声明的权利,使用者持续使用即视为接受修订后的条款。
    **在使用本项目的代码和功能之前,请您认真考虑并接受以上免责声明。如果您对上述声明有任何疑问或不同意,请不要使用本项目的代码和功能。如果您使用了本项目的代码和功能,则视为您已完全理解并接受上述免责声明,并自愿承担使用本项目的一切风险和后果。**

    ⭐ Star 趋势

    💡 项目参考


    File: docs/Release_Notes.md

    更新内容:

    1. API 模式搜索接口增加 offset 和 count 参数
    2. 修复部分 TikTok 账号提取 sec_user_id 失败的问题
    3. 修复 API 模式账号作品接口部分参数不生效的问题
    4. 修复配置文件 tab 参数无效导致报错的问题
    5. 修复 API 模式搜索接口多页数据报错的问题
    6. 修复 API 模式搜索接口结果为空报错的问题
    7. 修复 TikTok 平台批量下载账号作品功能
    8. 修复 TikTok 平台批量下载合集作品功能
    9. 修复报错时可能损坏 XLSX 文件的问题
    10. TikTok 平台新增 X-Gnarly 请求参数
    11. 实现动态加载外部 Python 代码功能
    12. 移除 从浏览器读取 Cookie 功能
    13. 服务器模式默认启用局域网访问
    14. 优化提取 secUid 的正则表达式
    15. 修复请求参数编码错误的问题
    16. 修复提取作品 ID 失败的问题
    17. 重构项目内置请求延时机制
    18. 恢复手动输入 Cookie 功能
    19. 更新数据接口请求参数
    20. 更新项目英语翻译
    21. 修正项目功能描述
    22. 修复其他已知问题

    File: locale/README.md

    命令参考

    运行命令前,确保已经安装了 gettext 软件包,并配置好环境变量。

    Before running the command, ensure that the gettext package is installed and the environment variables are properly
    configured.

    • xgettext --files-from=py_files.txt -d tk -o tk.pot
    • mkdir zh_CN\LC_MESSAGES
    • msginit -l zh_CN -o zh_CN/LC_MESSAGES/tk.po -i tk.pot
    • mkdir en_US\LC_MESSAGES
    • msginit -l en_US -o en_US/LC_MESSAGES/tk.po -i tk.pot
    • msgmerge -U zh_CN/LC_MESSAGES/tk.po tk.pot
    • msgmerge -U en_US/LC_MESSAGES/tk.po tk.pot

    翻译贡献指南

    • 如果想要贡献支持更多语言,请在终端切换至 locale 文件夹,运行命令 msginit -l 语言代码 -o 语言代码/LC_MESSAGES/tk.po -i tk.pot
      生成 po 文件并编辑翻译。
    • 如果想要贡献改进翻译结果,请直接编辑 tk.po 文件内容。
    • 仅需提交 tk.po 文件,作者会转换格式并合并。

    Translation Contribution Guide

    • If you want to contribute support for more languages, please switch to the locale folder in the terminal and run the
      command msginit -l language_code -o language_code/LC_MESSAGES/tk.po -i tk.pot to generate the po file and edit the
      translation.
    • If you want to contribute to improving the translation, please directly edit the content of the tk.po file.
    • Only the tk.po file needs to be submitted, and the author will convert the format and merge it.

    File: README_EN.md

    🔥 TikTok Posts/Liked/Mix/Live/Video/Image/Music; DouYin Posts/Liked/Favorites/Collections/Video/Image/LivePhoto/Live/Music/Mix/Comments/Account/Search/Hot Board Data Acquisition Tools: Fully open-source, free data collection and file download tool based on HTTPX module implementation; batch download of DouYin account posts works, liked works, favorites works and collections works; batch download of TikTok account posts works and liked works; download of DouYin linked or TikTok linked works; obtain DouYin live stream push addresses; download DouYin live stream video; obtain TikTok live stream push addresses; download TikTok live stream video; collect DouYin works comments data; batch download of DouYin Mix works; batch download of TikTok Mix works; collect detailed data of DouYin accounts; collect DouYin user/works/live search results; collect DouYin Hot Board data.
    ⭐ Previous project names: TikTokDownloader
    ⚠️ The encryption parameter algorithm for this project has expired and is no longer valid; to ensure legal and regulatory compliance, the parameter algorithm is no longer maintained, and some features may not work properly. If you need to use it, please prepare the encryption parameter generation code yourself. For configuration instructions, please refer to the documentation!
    ⭐ Due to the author's limited energy, I was unable to update the English document in a timely manner, and the content may have become outdated, partial translation is machine translation, the translation result may be incorrect, Suggest referring to Chinese documentation. If you want to contribute to translation, we warmly welcome you.


    📝 Project Features

    Function List (Click to Expand)

  • ✅ Download DouYin video/image
  • ✅ Download DouYin live photo
  • ✅ Download the highest quality video file
  • ✅ Download TikTok video source files
  • ✅ Download TikTok video/image
  • ✅ Download of DouYin account posts/liked/favorites works
  • ✅ Download of TikTok account posts/liked works
  • ✅ Collect detailed data from DouYin/TikTok
  • ✅ Batch download of linked works
  • ✅ Batch download of works from multiple accounts
  • ✅ Automatically skip already downloaded files
  • ✅ Persistently save collected data
  • ✅ Support CSV/XLSX/SQLite format for saving data
  • ✅ Download dynamic/static cover images
  • ✅ Obtain DouYin live stream push addresses
  • ✅ Obtain TikTok live stream push addresses
  • ✅ Use ffmpeg to download live video
  • ✅ Web UI interaction interface
  • ✅ Collect comments data from DouYin works
  • ✅ Batch download of DouYin Mix works
  • ✅ Batch download of TikTok Mix works
  • ✅ Record statistics such as likes and favorites
  • ✅ Filter works based on publication time
  • ✅ Support incremental downloading of account works
  • ✅ Support data Collections using proxies
  • ✅ Support remote access via LAN
  • ✅ Collect detailed data from DouYin accounts
  • ✅ Update statistics of works
  • ✅ Support custom account/mix mark
  • ✅ Automatically update account nickname/mark
  • ✅ Deploy to private servers
  • ✅ Deploy to public servers
  • ✅ Collect DouYin search data
  • ✅ Collect DouYin hot board data
  • ✅ Record IDs of already downloaded works
  • ☑️ Scan QR code to log in and obtain Cookies
  • ✅ Obtain Cookies from browsers
  • ✅ Support Web API calls
  • ✅ Support multithreaded downloading of works
  • ✅ File integrity processing mechanism
  • ✅ Custom rules for filtering works
  • ✅ Archive and save works files by folder
  • ✅ Customize file size limit
  • ✅ Support resume downloading of files from breakpoints
  • ✅ Monitor clipboard links to download works
  • 💻 Program Screenshot

    Watch Demo on Bilibili; Watch Demo on YouTube

    Terminal interaction mode

    It is recommended to manage accounts through configuration files. For more information, please refer to the documentation



    Web UI interaction mode

    The project code has been refactored; the code for this mode has not yet been updated. It will be reopened after
    future development is completed!

    Web API mode


    After starting this mode, Open http://127.0.0.1:5555/docs or http://127.0.0.1:5555/redoc to access the automatically
    generated documentation!

    API call example code

    python
    from httpx import post
    from rich import print
    
    
    def demo():
        headers = {"token": ""}
        data = {
            "detail_id": "0123456789",
            "pages": 2,
        }
        api = "http://127.0.0.1:5555/douyin/comment"
        response = post(api, json=data, headers=headers)
        print(response.json())
    
    
    demo()

    📋 Project Instructions

    Quick Start

    ⭐ Mac OS and Windows 10 and above users can go to Releases or Actions to download the compiled program, ready to use!
    ⭐ This project includes GitHub Actions for automatic building executable files. Users can use GitHub Actions to build the latest source code into executable files at any time!
    ⭐ For the automatic building executable files tutorial, please refer to the Build of Executable File Guide section of this document. If you need a more detailed step-by-step tutorial with illustrations, please check out this article!
    Note: Due to the macOS platform's executable file main not being code-signed, it will be restricted by system security measures on first run. Please execute the command xattr -cr project_folder_path in the terminal to remove the security flag, after which it can run normally.


    1. **Run the executable file** or **configure the environment to run** (choose one of the two)
        **Run the executable file**
      1. Download the executable file compressed file built by [Releases](https://github.com/JoeanAmier/TikTokDownloader/releases/latest) or Actions.
      2. After extracting, open the program folder and double-click to run `main`.
        **Configure the environment to run**
      1. Install [Python](https://www.python.org/) interpreter version not lower than `3.12`
      2. Download the latest source code or the source code released in [Releases](https://github.com/JoeanAmier/TikTokDownloader/releases/latest) to your local machine
        1. **Install project dependencies using pip**
        2. Run the command `python -m venv venv` to create a virtual environment (optional)
        3. Run the command `.\venv\Scripts\activate.ps1` or `venv\Scripts\activate` to activate the virtual environment (optional)
        4. Run the command `pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt` to install the required modules for the program
        5. Run the command `python .\main.py` or `python main.py` to start DouK-Downloader
          **Install project dependencies using uv (recommended)**
        1. Run the command `uv sync --no-dev` to synchronize environment dependencies
        2. Run the command `uv run main.py` to start DouK-Downloader
    2. Read the disclaimer of DouK-Downloader and enter content according to the prompt.
    3. Write Cookie Information into Configuration File
        **Manually Enter Cookie**
      1. Refer to the [Cookie Extraction Tutorial](https://github.com/JoeanAmier/TikTokDownloader/blob/master/docs/Cookie%E8%8E%B7%E5%8F%96%E6%95%99%E7%A8%8B.md), copy the required Cookie to the clipboard
      2. Select the `Manually Enter Cookie` option, paste the Cookie content and follow the program prompts
        **Read Cookie from Clipboard**
      1. Refer to the [Cookie Extraction Tutorial](https://github.com/JoeanAmier/TikTokDownloader/blob/master/docs/Cookie%E8%8E%B7%E5%8F%96%E6%95%99%E7%A8%8B.md), copy the required Cookie to the clipboard
      2. Select the `Extracting cookie from clipboard` option, the program will automatically read the Cookie from the clipboard and write it into the configuration file
        **Read Cookie from Browser (Deprecated)**
      1. Select the `Extracting cookie from browser` option, then follow the prompts to input the browser type or its corresponding number
        **Obtain Cookie via QR Code Login (No longer valid)**
      1. Select the `Scan code to login and get cookies (DouYin)` option, the program will display a login QR code image and open it with the default application
      2. Use the DouYin app to scan the QR code and log in
      3. Follow the prompts, the program will automatically write the Cookie into the configuration file
    4. Return to the program interface, sequentially select `Terminal Mode` -> `Batch Download Works from Links` -> `Manually enter the works links to be collected`.
    5. Input the DouYin works link to download the works file (the TikTok platform requires more initial setup, please refer to the documentation for details).
    6. For more detailed instructions, please see **[Project Documentation](https://github.com/JoeanAmier/TikTokDownloader/wiki/Documentation)**.
    ⭐ It is recommended to use [Windows Terminal](https://learn.microsoft.com/zh-cn/windows/terminal/install) (the default terminal that comes with Windows 11).

    Docker Container

    1. Get the image
    2. Method 1: Build the image using the `Dockerfile`.
    3. Method 2: Pull the image using the command `docker pull joeanamier/tiktok-downloader`.
    4. Method 3: Pull the image using the command `docker pull ghcr.io/joeanamier/tiktok-downloader`.
    5. Create the container: `docker run --name ContainerName(optional) -p HostPort:5555 -v tiktok_downloader_volume:/app/Volume -it <image name>`.
    6. **Note:** The `<image name>` here must be consistent with the image name you used in the first step (`joeanamier/tiktok-downloader` or `ghcr.io/joeanamier/tiktok-downloader`)
    7. Run the container
    8. Start the container: `docker start -i container name/container ID`.
    9. Restart the container: `docker restart -i container name/container ID`.
    Docker containers cannot directly access the host machine's file system, and some features may be unavailable, for example: `Get Cookie from Browser`; if there are any other issues, please report!

    Click to view Cookie tutorial

    • Cookie only needs to be re-written to the configuration file after it expires, and not every time the program is
      run.
    • The Cookie can affect the resolution of the video files downloaded from the DouYin platform. If you are unable to
      download high-resolution video files, please try updating the Cookie!
    • When the program fails to obtain data, you can try updating the Cookie or using a Cookie that is already logged in!

    Other Instructions

  • This project has a built-in intelligent delay request mechanism to avoid affecting platform servers due to excessive request frequency. If you need to disable it, please refer to the [documentation](https://github.com/JoeanAmier/TikTokDownloader/wiki/Documentation#%E9%AB%98%E7%BA%A7%E9%85%8D%E7%BD%AE)
  • When the program prompts the user for input, pressing Enter directly will return to the previous menu, and inputting `Q` or `q` will end the program's execution.
  • Since fetching data for liked and favorites works of an account only returns the publication dates of those works, not the dates of the actions (liking or favouring), the program needs to retrieve all liked and favorites works data before performing date filtering. If there are a large number of works, this may take a considerable amount of time. The number of requests can be controlled via the `max_pages` parameter.
  • To obtain data for posts made by a private account, a logged-in Cookie is required, and the logged-in account must follow the private account.
  • When batch downloading account posts works or mix works, if the corresponding nickname or mark parameter changes, the program will automatically update the nickname and mark parameter in the file names of the downloaded works.
  • When downloading files, the program first downloads them to a temporary folder and then moves them to the storage folder upon completion. The temporary folder will be emptied when the program ends.
  • The `Batch Download Favorites Works Mode` currently only supports downloading Favorites works for the account corresponding to the currently logged-in Cookie and does not support multiple accounts.
  • If you want the program to use a proxy to request data, set the `proxy` parameter in the configuration file `settings.json` (may consider using proxy services like: [Swiftproxy](https://www.swiftproxy.net/?ref=TikTokDownloader))
  • If your computer does not have a suitable program for editing JSON files, we recommend using the [Online Tool](https://www.toolhelper.cn/JSON/JSONFormat) to edit the configuration file content, after modification, the software needs to be restarted to take effect.
  • When the program prompts the user to input content or links, please be careful to avoid including newline characters, as this may cause unexpected issues.
  • This project does not support downloading paid works. Please do not report any issues related to downloading paid works.
  • On Windows systems, the program needs to be run as an administrator to read Cookies from Chromium, Chrome, and Edge browsers.
  • This project has not been optimized for running multiple instances of the program. If you need to run multiple instances, please copy the entire project folder to avoid unexpected issues.
  • During program execution, if you need to terminate the program or `ffmpeg`, please press `Ctrl + C` to stop the process. Do not click the close button on the terminal window directly.
  • Build of Executable File Guide

    Build of Executable File Guide (Click to Expand)

    This guide will walk you through forking this repository and executing GitHub Actions to automatically build and package
    the program based on the latest source code!


    Steps to Use

    1. Fork the Repository

    1. Click the Fork button at the top right of the project repository to fork it to your personal GitHub account
    2. Your forked repository address will look like this: https://github.com/your-username/this-repo

    2. Enable GitHub Actions

    1. Go to the page of your forked repository
    2. Click the Settings tab at the top
    3. Click the Actions tab on the right
    4. Click the General option
    5. Under Actions permissions, select Allow all actions and reusable workflows and click the Save button

    3. Manually Trigger the Build Process

    1. In your forked repository, click the Actions tab at the top
    2. Find the workflow named 构建可执行文件
    3. Click the Run workflow button on the right:
      • Select the master or develop branch
      • Click Run workflow

    4. Check the Build Progress

    1. On the Actions page, you can see the execution records of the triggered workflow
    2. Click on the run record to view detailed logs to check the build progress and status

    5. Download the Build Result

    1. Once the build is complete, go to the corresponding run record page
    2. In the Artifacts section at the bottom of the page, you will see the built result file
    3. Click to download and save it to your local machine to get the built program

    Notes

    1. Resource Usage:

      • GitHub provides free build environments for Actions, with a monthly usage limit (2000 minutes) for free-tier users
    2. Code Modifications:

      • You are free to modify the code in your forked repository to customize the build process
      • After making changes, you can trigger the build process again to get your customized version
    3. Stay in Sync with the Main Repository:

      • If the main repository is updated with new code or workflows, it is recommended that you periodically sync your
        forked repository to get the latest features and fixes

    Frequently Asked Questions

    Q1: Why can't I trigger the workflow?

    A: Please ensure that you have followed the steps to Enable Actions. Otherwise, GitHub will prevent the workflow
    from running

    Q2: What should I do if the build process fails?

    A:

    • Check the run logs to understand the cause of the failure
    • Ensure there are no syntax errors or dependency issues in the code
    • If the problem persists, please open an issue on
      the Issues page

    Q3: Can I directly use the Actions from the main repository?

    A: Due to permission restrictions, you cannot directly trigger Actions from the main repository. Please use the forked
    repository to execute the build process

    Program Update

    Method 1: Download and extract the files, then copy the old version of the _internal\Volume folder into the new version's _internal folder.
    Method 2: Download and extract the files (do not run the program), then copy all files and directly overwrite the old version.

    💝 Project Sponsorship

    Swiftproxy


    Access a global pool of 80M+ residential IPs optimized for TikTok and Douyin data extraction. Swiftproxy helps bypass rate limits, reduce blocks, and ensures stable downloads with seamless IP rotation.
    10% off code: PROXY90


    DartNode


    TikHub


    TikHub API offers over 700 endpoints to retrieve and analyze data from 14+ social media platforms—including videos, users, comments, stores, products, trends, and more—enabling one-stop access and analysis of all your data.
    Use invitation code: ZrdH8McC to register and recharge to get $2 credit.

    🌟 Contribution Guidelines

    **Welcome to contributing to this project! To keep the codebase clean, efficient, and easy to maintain, please read the following guidelines carefully to ensure that your contributions can be accepted and integrated smoothly.**
  • Before starting development, please pull the latest code from the `develop` branch as the basis for your modifications; this helps avoid merge conflicts and ensures your changes are based on the latest state of the project.
  • If your changes involve multiple unrelated features or issues, please split them into several independent commits or pull requests.
  • Each pull request should focus on a single feature or fix as much as possible, to facilitate code review and testing.
  • Follow the existing coding style; make sure your code is consistent with the style already present in the project; please use the Ruff tool to maintain code formatting standards.
  • Write code that is easy to read; add appropriate annotation to help others understand your intentions.
  • Each commit should include a clear and concise commit message describing the changes made. The commit message should follow this format: `<type>: <short description>`
  • When you are ready to submit a pull request, please prioritize submitting them to the `develop` branch; this provides maintainers with a buffer zone for additional testing and review before final merging into the `master` branch.
  • It is recommended to communicate with the author before starting development or when encountering questions to ensure alignment in direction and avoid redundant efforts or unnecessary commits.
  • Reference materials:

  • [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)
  • [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
  • ♥️ Support the Project

    If DouK-Downloader has been helpful to you, please consider giving it a Star ⭐. Your support is greatly appreciated!

    微信(WeChat) 支付宝(Alipay)

    If you're willing, consider making a contribution to provide additional support for DouK-Downloader!

    ✉️ Contact the Author

  • Author's Email: [email protected]
  • Author's WeChat: Downloader_Tools
  • Official WeChat Account: Downloader Tools
  • **Discord Community**: [Click to join the community](https://discord.com/invite/ZYtmgKud9Y)
  • ✨ The author's other open-source projects:

  • **XHS-Downloader(小红书、XiaoHongShu、RedNote)**:[https://github.com/JoeanAmier/XHS-Downloader](https://github.com/JoeanAmier/XHS-Downloader)
  • **KS-Downloader(快手、KuaiShou)**:[https://github.com/JoeanAmier/KS-Downloader](https://github.com/JoeanAmier/KS-Downloader)
  • ⚠️ Disclaimer

    1. The user's use of this project is entirely at their own discretion and responsibility. The author assumes no liability for any losses, claims, or risks arising from the user's use of this project.
    2. The code and functionalities provided by the author of this project are based on current knowledge and technological developments. The author strives to ensure the correctness and security of the code according to existing technical capabilities but does not guarantee that the code is entirely free of errors or defects.
    3. All third-party libraries, plugins, or services relied upon by this project follow their respective open-source or commercial licenses. Users must review and comply with those license agreements. The author assumes no responsibility for the stability, security, or compliance of third-party components.
    4. Users must strictly comply with the requirements of the [GNU General Public License v3.0](https://github.com/JoeanAmier/TikTokDownloader/blob/master/LICENSE) when using this project and properly indicate that the code was used under the [GNU General Public License v3.0](https://github.com/JoeanAmier/TikTokDownloader/blob/master/LICENSE).
    5. When using the code and features of this project, users must independently research relevant laws and regulations and ensure their actions are legal and compliant. Any legal liabilities or risks arising from violations of laws and regulations shall be borne solely by the user.
    6. Users must not use this tool to engage in any activities that infringe intellectual property rights, including but not limited to downloading or distributing copyright-protected content without authorization. The developers do not participate in, support, or endorse any unauthorized acquisition or distribution of illegal content.
    7. This project assumes no responsibility for the compliance of any data processing activities (including collection, storage, and transmission) conducted by users. Users must comply with relevant laws and regulations and ensure that their processing activities are lawful and proper. Legal liabilities resulting from non-compliant operations shall be borne by the user.
    8. Under no circumstances may users associate the author, contributors, or other related parties of this project with their usage of the project, nor may they hold these parties responsible for any loss or damage arising from such usage.
    9. The author of this project will not provide a paid version of the DouK-Downloader project, nor will they offer any commercial services related to the DouK-Downloader project.
    10. Any secondary development, modification, or compilation based on this project is unrelated to the original author. The original author assumes no liability for any consequences resulting from such secondary development. Users bear full responsibility for all outcomes arising from such modifications.
    11. This project grants no patent licenses; if the use of this project leads to patent disputes or infringement, the user bears all associated risks and responsibilities. Without written authorization from the author or rights holder, users may not use this project for any commercial promotion, marketing, or re-licensing.
    12. The author reserves the right to terminate service to any user who violates this disclaimer at any time and may require them to destroy all obtained code and derivative works.
    13. The author reserves the right to update this disclaimer at any time without prior notice. Continued use of the project constitutes acceptance of the revised terms.
    **Before using the code and functionalities of this project, please carefully consider and accept the above disclaimer. If you have any questions or disagree with the statement, please do not use the code and functionalities of this project. If you use the code and functionalities of this project, it is considered that you fully understand and accept the above disclaimer, and willingly assume all risks and consequences associated with the use of this project.**

    ⭐ Star History

    💡 Project References