Operations 5 min read

How to Use Linux Headless Chrome to Browse and Capture Douyin Content

This guide walks through setting up a Linux environment with a custom YUM repository, installing Google Chrome, and using headless Chrome commands to search, capture screenshots, and access Douyin pages directly from the command line.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Use Linux Headless Chrome to Browse and Capture Douyin Content

1. Add a custom YUM repository for Google Chrome

vim /etc/yum.repos.d/google-chrome.repo

2. Repository configuration

name=google-chrome baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64 enabled=1 gpgcheck=1 gpgkey=https://dl.google.com/linux/linux_signing_key.pub

3. Install Google Chrome

# yum -y install google-chrome-stable --nogpgcheck

4. Verify the installed version

# google-chrome --version

5. Use headless Chrome from the command line

5.1 Capture a screenshot of a page

# google-chrome --no-sandbox --headless --disable-gpu \
    --screenshot https://www.baidu.com/

This creates screenshot.png in the current directory and prints warnings about the missing user‑data directory and GPU support.

5.2 Capture search results

# google-chrome --no-sandbox --headless --disable-gpu \
    --screenshot "https://www.baidu.com/s?wd=足球宝贝"

5.3 Capture a Douyin live page

# google-chrome --no-sandbox --headless --disable-gpu \
    --screenshot https://www.douyin.com/live/...

5.4 Dump the DOM of a page

# google-chrome-stable --no-sandbox --headless --disable-gpu \
    --dump-dom https://www.baidu.com/

The command outputs the page’s HTML to the terminal.

6. Notes

The --no-sandbox flag is required when Chrome is run as root.

Headless mode disables GPU; warnings about "Passthrough is not supported, GL is swiftshader" are normal.

Use full URLs (including protocol) for all commands.

Output files (e.g., screenshot.png) are written to the current working directory.

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.

Linuxshell scriptHeadless ChromeWeb AutomationDouyin
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.