📌 抖音自动上传脚本部署教程

1、安装 Node.js

点击进入


2、创建目录存放脚本

注意:下面代码要用 PowerShell 打开
mkdir C:\playwright-douyin
cd C:\playwright-douyin

3、设置 PowerShell 执行策略

将执行策略(Execution Policy)设置为 RemoteSigned

powershell

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

4、列出不同作用域下的执行策略值

powershell

Get-ExecutionPolicy -List

5、初始化项目

powershell

npm init -y

6、安装 Playwright

powershell

npm i playwright

7、安装 Chromium 浏览器

powershell

npx playwright install chromium

8、下载自动上传脚本

点击进入

9、登录抖音

注意:要点一下 高清发布 才能生成登录的 auth.json

powershell

node .\uploader_douyin.mjs --setup --state="C:\playwright-douyin\state\auth.json" --debug

10、进入目录

powershell

cd C:\playwright-douyin

11、运行脚本

powershell

node .\uploader_douyin.mjs (Get-ChildItem "D:\Video_Generation\Output\combined" -Filter *.mp4 | Select-Object -First 1).FullName "【神国之上】 #小说动漫 #神国之上"

12、设置定时任务

创建 uploader.ps1

C:\playwright-douyin 目录下创建 uploader.ps1 文件,输入以下命令:

powershell

node "C:\playwright-douyin\uploader_douyin.mjs" (Get-ChildItem "D:\Video_Generation\Output\combined" -Filter *.mp4 | Select-Object -First 1).FullName "【神国之上】 #小说动漫 #神国之上"

打开 Windows 任务计划程序

  • Win + R,输入 taskschd.msc → 回车
  • 在右边点击 创建基本任务

设置任务

  • 名称​:如 DouyinUploader
  • 触发器​:选择执行时间(每天 / 每周 / 每月,具体几点几分)
  • 操作​:选择 启动程序

配置执行命令

  • 程序或脚本 填:powershell.exe
  • 添加参数 填:
    代码

    -NoProfile -ExecutionPolicy Bypass -File "C:\playwright-douyin\uploader.ps1"
  • 起始于 填:
    代码

    C:\playwright-douyin