MediaCrawler: Deep Dive into an Open-Source Crawler Framework Covering Seven Major Platforms

An open-source Python crawler framework using Playwright to scrape data from seven major Chinese social platforms.
MediaCrawler is a popular open-source Python crawler framework with 57K+ GitHub Stars that collects data from seven major Chinese platforms including Xiaohongshu, Douyin, Bilibili, and Zhihu. Using Playwright browser automation instead of API reverse engineering, it avoids the complexity of cracking encrypted signatures while maintaining stability against platform updates. The article covers its technical architecture, use cases in research and AI training, compliance considerations, and performance trade-offs.
Project Overview: A Crawler Framework Covering Seven Major Platforms
In the data-driven era, social media content has become a vital source for public opinion analysis, market research, and content creation. The GitHub open-source project NanmiCoder/MediaCrawler was built precisely to address this need. Written in Python, the project has accumulated over 57,000 Stars, making it one of the most popular open-source crawler projects in China.
MediaCrawler's core positioning is crystal clear: it integrates data collection capabilities across major Chinese content platforms, covering Xiaohongshu (RED), Douyin (TikTok China), Kuaishou, Bilibili, Weibo, Baidu Tieba, and Zhihu — seven platforms in total. It can scrape notes, videos, posts, Q&A articles, and their corresponding comments and replies. This "all-in-one" multi-platform coverage sets it apart from similar open-source crawler tools.

Technical Highlights: A Browser Automation-Based Approach to Data Collection
No JS Reverse Engineering Required
MediaCrawler's most commendable technical choice is that it doesn't rely on traditional API reverse engineering. Instead, it leverages Playwright browser automation technology to drive a real browser environment for login and data retrieval.
Playwright is an open-source browser automation framework developed by Microsoft, supporting three major browser engines: Chromium, Firefox, and WebKit. Its core team originated from Google's Puppeteer project, and it offers a more modern API design, faster execution speed, and more reliable waiting mechanisms on top of that foundation. Compared to traditional Selenium, Playwright natively supports auto-waiting for element loading, network request interception, mobile device emulation, and headless mode — running without displaying a browser window, executing operations entirely in the background. In the crawler domain, Playwright's greatest value lies in its ability to fully render JavaScript dynamic content. Even when target websites heavily use frontend frameworks like React or Vue to dynamically load data, it can capture the final rendered page content.
The biggest advantage of this approach is that developers don't need to spend enormous effort cracking each platform's constantly changing encryption parameters and signature algorithms.
For platforms like Xiaohongshu and Douyin, which have particularly strict anti-crawling mechanisms, parameter encryption (such as x-s, a_bogus signatures) is often the biggest obstacle facing developers. API reverse engineering refers to analyzing a platform's HTTP/HTTPS API requests through packet capture, then simulating these requests in code to directly obtain data. However, to combat crawlers, major Chinese platforms commonly introduce complex encrypted signature parameters into their requests — for example, Xiaohongshu's x-s and x-t signature parameters are generated through multiple layers of obfuscated JavaScript code, and Douyin's a_bogus parameter involves encrypted computation of device fingerprints and timestamps. These signature algorithms are typically protected by code obfuscation, control flow flattening, and other protection techniques, making reverse analysis extremely time-consuming. More critically, platforms periodically update these encryption logics, meaning reverse engineering results often have a limited shelf life.
By simulating real user operations in a browser, MediaCrawler elegantly bypasses this challenge and maintains good stability even after platform risk control strategies are updated.
Login State Reuse and Cookie Management
The project supports maintaining login state through multiple methods, including QR code scanning login and Cookie import, allowing reuse of authenticated session information during data collection.
Cookies are the core mechanism by which web applications maintain user session state. When a user logs into a platform through a browser, the server returns a set of Cookies containing session identifiers (Session IDs) or authentication tokens. The browser automatically carries these Cookies in subsequent requests to prove the user's identity. The principle behind login state reuse in MediaCrawler is extracting these Cookies and persistently storing them, then injecting them into subsequent collection requests to skip the repeated login process. The QR code login implementation specifically uses Playwright to open the platform's login page, waits for the user to complete QR code verification, then automatically extracts and saves the Cookies from the browser context. This approach is more secure than username/password login and avoids the additional complexity of CAPTCHA recognition. It's worth noting that Cookies typically have expiration time limits, and long-running collection tasks need mechanisms for automatic renewal or re-login.
This design both improves the success rate of data scraping and makes batch collection more feasible.

Use Cases: Who's Using MediaCrawler
Academic Research and Public Opinion Monitoring
For researchers in social sciences and communication studies, comment data from social platforms is an invaluable sample for analyzing public sentiment and tracking topic propagation paths. MediaCrawler can batch-collect comments and replies under specified keywords or specific content, providing a data foundation for quantitative research.
Content Creation and Competitive Analysis
For content creators and operations professionals, understanding competitors' viral content characteristics and comment section feedback on Xiaohongshu and Douyin is an important reference for optimizing their own content strategies. By collecting and analyzing this data, they can more precisely grasp user preferences and trending topics.
Data Science and Model Training
With the proliferation of large language models, demand for high-quality Chinese language corpora has surged. Since ChatGPT sparked the LLM boom in 2022, the scarcity of high-quality training corpora has become a key bottleneck constraining the development of Chinese LLMs. Compared to English corpora, publicly available high-quality Chinese text data is relatively scarce — Chinese content in public datasets like Common Crawl accounts for a low proportion and varies greatly in quality. User-generated content (UGC) on social media, characterized by its colloquial nature, diversity, and timeliness, has become an important source for supplementing Chinese training corpora. Particularly in vertical domains (such as beauty, electronics, food, etc.), professional discussions on Xiaohongshu and Zhihu often contain rich domain knowledge and authentic user expressions.
Multi-platform real user content and comments can serve as one of the sources for domain-specific datasets, providing material for model fine-tuning and training. However, using this data for model training is also controversial: companies like OpenAI and Meta have already faced multiple copyright lawsuits for using internet content to train models without authorization, and China's legal and regulatory frameworks are also tightening requirements on the legality of training data sources.
Usage Guidelines: Compliance and Ethical Boundaries
It must be particularly emphasized that the use of any crawler tool must be built on a foundation of legality and compliance. The "for learning and research purposes only" statement in MediaCrawler's project documentation is not a mere disclaimer — it's a baseline that users must take seriously.
Key Considerations for Data Collection
- Comply with platform robots protocols and terms of service: robots.txt is a gentleman's agreement between websites and crawlers, placed by website administrators in the domain's root directory to declare which paths allow or prohibit crawler access. Although robots protocols are not technically enforceable, in multiple court cases, crawler behavior that violates robots protocols has been considered an important factor in infringement judgments. Bypassing technical restrictions to scrape large volumes of data may violate platform terms of service.
- Protect personal privacy: Collected comments and user information involve personal data, and their processing and storage must comply with the Personal Information Protection Law (PIPL) and other relevant laws and regulations. Under China's legal system, the PIPL, which took effect in 2021, imposes strict regulations on the collection, storage, and use of personal information. Collecting and processing personal data without the data subject's consent may lead to serious legal consequences.
- Control collection frequency: High-frequency requests put pressure on target servers and easily trigger risk control bans. Reasonable collection intervals should be set.
- Exercise caution with commercial use: When using collected data for commercial monetization, legal risks increase significantly. Compliance must be evaluated in advance. The legal risks primarily include unfair competition liability under the Anti-Unfair Competition Law, as well as criminal liability under Article 285 of the Criminal Law regarding the crime of illegally obtaining computer information system data. Additionally, the Interim Administrative Measures for Generative AI Services issued by the Cyberspace Administration of China in 2023 also explicitly requires legitimate sources for training data.
MediaCrawler's Open-Source Value and Limitations
What Deserves Recognition
MediaCrawler's nearly 60,000 Stars clearly demonstrate that it meets the practical needs of a large number of developers. Its modular design keeps the collection logic for different platforms relatively decoupled, allowing users to selectively use what they need. An active open-source community also means that when a platform updates its risk control strategy, the project can often be fixed and adapted relatively quickly.
Objective Limitations
On the other hand, while browser automation-based approaches offer good stability, they are relatively less efficient than direct API calls, consume more CPU and memory resources, and are not well-suited for ultra-large-scale distributed collection scenarios.
The fundamental reason for this efficiency gap lies in the enormous difference in resource overhead. Launching a Chromium browser instance typically requires 150-300MB of memory, while a simple HTTP request client might need only a few MB. The browser needs to fully load and render the page (including CSS, JavaScript, images, and other resources), while API calls only transmit the necessary JSON data. In terms of collection speed, a single browser page load may take 2-5 seconds, while a single API request typically completes within 100-500 milliseconds. In distributed collection scenarios requiring hundreds of simultaneous collection tasks, the browser approach's CPU and memory demands on servers grow multiplicatively. However, the browser approach also has unique advantages: it naturally supports JavaScript rendering, automatically handles redirects and dynamic loading, and its request characteristics are highly consistent with real users, resulting in a lower probability of detection by risk control systems.
Furthermore, anti-crawling strategies across platforms continue to evolve, and no crawler tool can guarantee long-term availability. Users should be prepared for ongoing maintenance and adaptation.
Conclusion
MediaCrawler is a mature and popular open-source solution for multi-platform content collection in China. Its technical approach of using browser automation instead of API reverse engineering effectively lowers the barrier to social media data acquisition and gives it a unique position among similar Python crawler projects.
However, the neutrality of technology itself does not equate to unconstrained use. While enjoying the convenience of tools, developers should clearly recognize the legal and ethical responsibilities behind data collection. Using these open-source crawler tools reasonably, compliantly, and with restraint is the right way to realize their true value.
Related articles

Kimi K3 Deep Dive: 2.8 Trillion Parameter Open-Source Model Closes the Gap with Closed-Source Frontier for the First Time
Moonshot AI releases Kimi K3 open-weight model with 2.8T parameters and 1M token context. Our deep dive covers coding, 3D dev, agent capabilities, and safety concerns.

How to Choose an AI Agent Platform for Your Team: 5 Evaluation Dimensions and a Decision Framework
Choose the right AI Agent platform by evaluating model flexibility, observability, tool integration, security compliance, and total cost. A complete decision framework to help technical leaders avoid vendor lock-in.

Legora's Legal AI Practice: How Vertical AI Empowers Law Firms and Corporate Legal Transformation
Explore Legora's legal vertical AI practice, covering AI model selection strategies, enterprise legal transformation challenges, and the path to deploying vertical AI in the legal industry.