Open-source project
saermart/DouyinLiveWebFetcher avatar
saermart/DouyinLiveWebFetcher

DouyinLiveWebFetcher: collecting Douyin live-room events in Python

抖音直播间网页版的弹幕数据抓取(2025最新版本)

1,867 stars571 forksPythonAGPL-3.0

At a glance

What is it?
DouyinLiveWebFetcher is a Python project for collecting live-room events through Douyin's web interface. It combines JavaScript signature generation with Protocol Buffers decoding, but its undocumented setup and close coupling to changing web APIs make it suitable primarily for controlled research.
Who is it for?
Researchers who already understand Douyin's changing web protocols may adopt this project for controlled event collection. Operators should first verify that the signing approach still matches the target site and that their intended use complies with the project's AGPL-3.0 license and its stated restriction against improper or commercial use.
Can I use it commercially?
Yes, with strict conditions. AGPL-3.0 is a network copyleft licence: if people use a modified version over a network, for example as a hosted service, you must offer them its source code under the same licence.
Is it still maintained?
Yes. The repository last received commits 45 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

DouyinLiveWebFetcher's live-room event scope

DouyinLiveWebFetcher addresses a narrow data-collection problem: reading activity from a Douyin live room through its web-facing infrastructure rather than presenting a separate room viewer. Based on the repository layout, its intended users are Python developers studying web protocol behavior, live-room event processing, or the decoding of signed network messages. It is not a general analytics platform and the documentation does not describe dashboards, historical storage, multiple account support, or a supported public API.

The sample output defines the practical event scope. It includes chat messages, likes, gifts, fan-club notifications, viewer statistics, and entry notices with identifiers and apparent gender labels. Statistics include current viewers and cumulative viewers. This makes the project closer to a message decoder than a complete live-room archive. The sample also shows free-form user text, which means output handling must account for variable content and names that contain punctuation or non-ASCII characters.

The README frames the repository for learning, research, and communication. It expressly prohibits use for commercial profit, system disruption, personal-information theft, and other improper or unlawful activity. That is a narrower usage restriction than the license alone. Engineers evaluating it for a product should therefore treat the README statement, the AGPL-3.0 license, applicable privacy rules, and Douyin platform terms as separate constraints.

Signing, WebSocket data, and protobuf decoding in DouyinLiveWebFetcher

The file layout exposes the implementation as a mixed Python and JavaScript pipeline. Request generation is associated with `ac_signature.py`, `sign.js`, `sign_v0.js`, and `a_bogus.js`. Incoming event definitions are represented by `douyin.proto` and the `protobuf/` directory. The dependency list adds `PyExecJS` and `mini_racer`, which places JavaScript execution inside the Python process, while `requests` handles HTTP requests and `websocket-client` handles the live-room connection.

The documented data flow can therefore be described conservatively. Python initiates requests and maintains the WebSocket client. JavaScript participates in signature generation, including the `a_bogus` parameter noted in the project's test history. Received messages are decoded against Protocol Buffer definitions before the project emits formatted Chinese text such as `【聊天msg】`, `【礼物msg】`, and `【统计msg】`. The exact room URL, login behavior, message identifiers, retry policy, and callback API are not described in the README, so the visible filenames should not be mistaken for a documented public API.

This design is tightly coupled to an unofficial or reverse-engineered web protocol surface. The README records changes to signature acquisition, the `wss` address, the barrage interface, and `a_bogus`, which demonstrates that upstream interface changes can require code changes. The protobuf layer is useful once a message is acquired, but it does not make the whole collection path stable.

Windows, Python, protoc, Node.js, and undocumented installation

The README specifies Windows 10, Python 3.7 or later, `protoc` version `libprotoc 25.1`, and NodeJs v18.2.0. It does not document repository acquisition, dependency installation, environment variables, account preparation, or the exact command that starts `main.py` or `liveMan.py`. For that reason, this tutorial cannot provide an invented setup command.

A first use begins by obtaining the repository through its Git hosting page, but the README does not name a clone command. Install the pinned Python packages listed in `requirements.txt` using the package manager appropriate for the chosen environment. Do not assume that `protoc` or NodeJs is optional: the documented toolchain includes both, and the JavaScript and protobuf files indicate why they are present.

The requirements are exact pins rather than compatible ranges:

text
requests==2.31.0
betterproto==2.0.0b6
websocket-client==1.7.0
PyExecJS==1.5.1
mini_racer==0.12.4

Before trying to collect a live room, inspect `main.py` and `liveMan.py` for the room input and startup sequence, because the README does not document either. The expected first result is formatted live-room messages or a connection error. No authenticated cookies, room identifier format, CLI flags, or success exit conditions are supplied, so there is no basis here for promising a particular command line.

Interpreting DouyinLiveWebFetcher sample messages

The repository's sample is useful for understanding output, but it does not promise a stable schema. Chat lines include a numeric user identifier followed by a display name and message text. Likes are aggregated in wording such as `点了9个赞`, while gift lines identify the sender and gift. Entry messages carry an identifier, a displayed gender label, a name, and an entry notice. These fields come from example console text, not from a formal schema.

Consumers should avoid assuming that every event has the same fields. A statistics message may arrive when no chat line is emitted, and a user name can include characters that complicate terminal output or downstream parsing. The sample is plain text rather than JSON, so machine integration will require capturing or converting output unless the entry points expose callbacks that are documented elsewhere. The README does not document those callbacks.

The samples also show why ethical controls matter. Even a technical event stream can contain user identifiers, display names, chat text, gender labels, and fan-club activity. The repository is not a privacy-preserving analytics pipeline, and the README does not describe retention, deletion, anonymization, or access control. Any experiment should collect only what is needed and avoid republishing personal information.

Compatibility and completeness limits of the web fetcher

The strongest limitation is upstream volatility. The README's dated test list includes signature changes, a `wss` update, barrage-interface changes, and the addition of `a_bogus`. It also states that a compiled Windows release became available on 2026-08-26. Those entries show that successful operation depends on compatibility with external web behavior rather than solely on local code.

The project is the wrong tool when a dependable, supported data contract is required. The README provides no formal stability policy, no compatibility guarantee, no delivery guarantee for every message, and no documentation for reconnecting after disconnection. It also does not explain handling of rate limits, expired sessions, malformed packets, duplicate events, or changes in room access. A missing statistic or gift event should not automatically be interpreted as an accurate zero.

Windows 10 is the only operating system explicitly listed, so Linux and macOS adoption would be an unsupported extrapolation. Python 3.7+ and NodeJs v18.2.0 are stated, but the pinned `betterproto==2.0.0b6` is a beta release. The available `win64` release may reduce local build work for its intended platform, but the README does not document its configuration, signing, source reproducibility, or update policy.

DouyinLiveWebFetcher compared with direct API integration

The practical alternative is direct integration through an officially supported Douyin capability, when one exists for the required data and use case. The difference is not merely code length. This repository reproduces a web protocol path through signature scripts, WebSocket handling, custom protobuf definitions, and JavaScript execution. A supported integration would normally expose a documented contract and define its authentication and stability boundaries, although this material does not identify a particular official endpoint or product.

Another alternative is a platform-approved live-room data provider. Such a provider would accept that live data depends on authorized access rather than treating a reverse-engineered web stream as an application interface. Its exact capabilities and terms would need separate verification. Compared with either route, DouyinLiveWebFetcher offers direct access to the specific event formats shown in its samples, but it transfers responsibility for protocol changes and operational failures to the adopter.

The choice should follow the required guarantee. Use this project for a bounded research prototype where protocol inspection is part of the objective. Do not treat its console output as an authoritative or complete record for compliance, moderation, billing, or audience measurement without separately validating the source and coverage.

Maintenance history and AGPL-3.0 obligations for adopters

The repository is not archived, and its last push was on 2026-09-08. The README records successful checks through 2026-08-26 and notes that a compiled version was added on that date. These facts indicate recent repository activity, but they do not guarantee that every Douyin protocol change will be handled promptly.

The repository is licensed under AGPL-3.0. That matters if Python code is modified and distributed or a network service makes modified versions available to users, because the license contains source and notice obligations. This is not legal advice. The README also restricts use to learning, research, and communication and warns about improper or commercial use. License compliance and compliance with the README's stated boundary are separate checks.

Upgrade cost is likely to include more than ordinary package updates. Signature generation, the `wss` endpoint, barrage requests, and `a_bogus` can require changes as the web interface changes. The beta `betterproto` pin and the mixed Python, JavaScript, NodeJs, and `protoc` toolchain also increase environment maintenance. Before upgrading, compare `sign.js`, `sign_v0.js`, `a_bogus.js`, and the protobuf definitions rather than assuming that installing new package versions is sufficient.

Editorial conclusion

Researchers who already understand Douyin's changing web protocols may adopt this project for controlled event collection. Operators should first verify that the signing approach still matches the target site and that their intended use complies with the project's AGPL-3.0 license and its stated restriction against improper or commercial use. A production service should not be based on this repository until message completeness, reconnect behavior, and failure handling are verified.

Frequently asked questions

What does DouyinLiveWebFetcher collect from a Douyin live room?

Its sample output includes chat, likes, gifts, fan-club messages, viewer statistics, and room-entry notices. The README does not define a complete or stable event schema.

What environment does DouyinLiveWebFetcher require?

The README lists Windows 10, Python 3.7 or later, `protoc` version `libprotoc 25.1`, and NodeJs v18.2.0. It does not provide a complete installation or startup tutorial.

Why might DouyinLiveWebFetcher stop receiving live-room events?

The README records previous updates to signature generation, the `wss` address, the barrage interface, and the `a_bogus` parameter. It does not document retry behavior, so changes or connection failures may require code inspection and adaptation.

Can DouyinLiveWebFetcher be used commercially?

The README says the code is only for learning, research, and communication and explicitly includes commercial profit among prohibited uses. The repository is also licensed under AGPL-3.0.

Official sources

  1. Issues
  2. License: AGPL-3.0
  3. README
  4. Releases
  5. saermart/DouyinLiveWebFetcher on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/saermart-douyinlivewebfetcher.svg)](https://hysenlabs.com/projects/saermart-douyinlivewebfetcher)

Was this useful?