Automate Qutoutiao Short Video Uploads with Python & Selenium

This tutorial demonstrates how to use Python and Selenium to automatically log in, upload videos and cover images, set titles, descriptions, tags, and publish short videos on the Qutoutiao platform, providing complete source code and step‑by‑step instructions.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Automate Qutoutiao Short Video Uploads with Python & Selenium

Python+Selenium Automation - Qutoutiao Short Video Upload and Publish

This article is part of a series that introduces automatic publishing for mainstream short‑video platforms (Douyin, Kuaishou, Bilibili, Xiaohongshu, Weishi, Baidu Haokan, Xigua, WeChat Channels, Sohu, Yidian, Dafeng, Qutoutiao, etc.). It focuses on automating video upload for Qutoutiao.

Chapter 1: Effect Demonstration

Two examples are shown: one is the video file, the other is a cover image whose pixel size is not smaller than the video.

Chapter 2: Implementation Process

1. Launch an Enabled Browser

By launching a browser that is already logged in, the script can skip the login step each time.

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("debuggerAddress", "127.0.0.1:5003")
driver = webdriver.Chrome(options=options)

2. Upload Video and Cover

# Upload video
driver.find_element_by_xpath('//input[@type="file"]').send_keys(path_mp4)
# Wait for upload to finish
while True:
    time.sleep(3)
    try:
        driver.find_element_by_xpath('//*[contains(text(),"上传成功")]')
        break
    except Exception as e:
        print("视频还在上传中···")
print("视频已上传完成!")
# Add cover
time.sleep(1)
driver.find_element_by_xpath('//*[@class="el-upload"]').click()
time.sleep(1)
driver.find_element_by_xpath('//*[text()="自定义封面"]').click()
time.sleep(1)
driver.find_element_by_xpath('//*[text()="选择图片"]/../..//input[@type="file"]').send_keys(path_cover)
time.sleep(3)
driver.find_element_by_xpath('//*[text()="确定"]').click()

3. Full Source Code

import selenium
from selenium import webdriver
import pathlib
import time
from selenium.webdriver.common.keys import Keys

# Basic information
catalog_mp4 = r"C:\Users\Administrator\Desktop\视频发布"
describe = "裸眼3D看蜘蛛侠 #搞笑 #电影 #视觉震撼"

options = webdriver.ChromeOptions()
options.add_experimental_option("debuggerAddress", "127.0.0.1:5003")
driver = webdriver.Chrome(options=options)

path = pathlib.Path(catalog_mp4)
# Find video file
path_mp4 = ""
for i in path.iterdir():
    if ".mp4" in str(i):
        path_mp4 = str(i)
        break
if path_mp4 != "":
    print("检查到视频路径:" + path_mp4)
else:
    print("未检查到视频路径,程序终止!")
    exit()
# Find cover file
path_cover = ""
for i in path.iterdir():
    if ".png" in str(i) or ".jpg" in str(i):
        path_cover = str(i)
        break
if path_cover != "":
    print("检查到封面路径:" + path_cover)
else:
    print("未检查到封面路径,程序终止!")
    exit()

def publish_qutoutiao():
    """Publish a video on Qutoutiao"""
    driver.get("https://mp.qutoutiao.net/publish-content/video")
    time.sleep(2)
    driver.find_element_by_xpath('//input[@type="file"]').send_keys(path_mp4)
    # Wait for upload
    while True:
        time.sleep(3)
        try:
            driver.find_element_by_xpath('//*[contains(text(),"上传成功")]')
            break
        except Exception:
            print("视频还在上传中···")
    print("视频已上传完成!")
    # Title
    driver.find_element_by_xpath('//*[@placeholder="内容标题5-30字"]').clear()
    time.sleep(2)
    driver.find_element_by_xpath('//*[@placeholder="内容标题5-30字"]').send_keys(describe)
    # Description
    time.sleep(1)
    driver.find_element_by_xpath('//textarea').clear()
    time.sleep(2)
    driver.find_element_by_xpath('//textarea').send_keys(describe)
    # Category
    time.sleep(1)
    driver.find_element_by_xpath('//*[@placeholder="请选择分类"]').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[text()="电影"]').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[text()="分类:"]').click()
    time.sleep(1)
    # Tags
    time.sleep(1)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').click()
    time.sleep(2)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').send_keys("视觉震撼")
    time.sleep(2)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').send_keys(Keys.ENTER)
    time.sleep(2)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').send_keys("搞笑")
    time.sleep(2)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').send_keys(Keys.ENTER)
    time.sleep(2)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').send_keys("电影")
    time.sleep(2)
    driver.find_element_by_xpath('//*[@class="content-tag"]//input').send_keys(Keys.ENTER)
    # Add cover
    time.sleep(1)
    driver.find_element_by_xpath('//*[@class="el-upload"]').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[text()="自定义封面"]').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[text()="选择图片"]/../..//input[@type="file"]').send_keys(path_cover)
    time.sleep(3)
    driver.find_element_by_xpath('//*[text()="确定"]').click()
    # Manual check and publish (commented out)
    # driver.find_element_by_xpath('//*[text()="发布"]').click()

publish_qutoutiao()

Article source: Python Programming Learning Circle (copyright belongs to the original author).

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonWeb ScrapingVideo UploadSeleniumQutoutiao
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.