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.
1. Add a custom YUM repository for Google Chrome
vim /etc/yum.repos.d/google-chrome.repo2. 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 --nogpgcheck4. Verify the installed version
# google-chrome --version5. 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
