Environment:666ghj BettaFish Playwright
| Knowledge Sources | |
|---|---|
| Domains | Crawling, Browser_Automation, Infrastructure |
| Last Updated | 2026-10-08 21:30 GMT |
Overview
Playwright browser automation framework for headless social media crawling via the MediaCrawler submodule.
Description
This environment provides the Playwright Python library, which drives headless Chromium-based browsers for social media platform crawling. The MediaCrawler submodule (used by PlatformCrawler) relies on Playwright to navigate platforms like Xiaohongshu, Douyin, Kuaishou, Bilibili, and Weibo. Playwright handles cookie injection, page rendering, anti-bot detection evasion, and content extraction. Browser binaries must be installed separately via `playwright install`.
Usage
Use this environment when running PlatformCrawler multi-platform crawling tasks. It is required by the PlatformCrawler implementation for browser-based social media scraping.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, Windows | Headless mode on all platforms |
| Hardware | 4GB+ RAM | Browser automation is memory-intensive |
| Disk | 1GB+ | For Playwright browser binaries |
| Network | Outbound HTTPS | Required to reach social media platforms |
Dependencies
System Packages
- Playwright browser binaries (`playwright install`)
Python Packages
- `playwright` == 1.45.0
Credentials
No direct environment variables. Platform login cookies are configured within MediaCrawler's own configuration.
Quick Install
# Install Playwright Python package
pip install playwright==1.45.0
# Install browser binaries (Chromium)
playwright install
Code Evidence
Version pin from `requirements.txt:46`:
playwright==1.45.0
MindSpider requirements from `MindSpider/requirements.txt:40`:
playwright==1.45.0
PlatformCrawler MediaCrawler path from `MindSpider/DeepSentimentCrawling/platform_crawler.py:32-42`:
self.mediacrawler_path = Path(__file__).parent / "MediaCrawler"
self.supported_platforms = ['xhs', 'dy', 'ks', 'bili', 'wb', 'tieba', 'zhihu']
db_config_path = self.mediacrawler_path / "config" / "db_config.py"
if not self.mediacrawler_path.exists() or not db_config_path.exists():
raise FileNotFoundError("MediaCrawler子模块未初始化,请先运行: git submodule update --init --recursive")
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Executable doesn't exist` | Browser binaries not installed | Run `playwright install` |
| `playwright._impl._api_types.Error: Page.goto: net::ERR_` | Network or platform blocking | Check VPN/proxy, verify platform is accessible |
| `TimeoutError` | Page load timeout | Increase timeout or check network speed |
Compatibility Notes
- Version pin: Playwright is pinned to `1.45.0` across both `requirements.txt` and `MindSpider/requirements.txt`.
- Browser binaries: Must be installed separately via `playwright install` — the pip package does not include browsers.
- Headless mode: Crawling runs in headless mode by default for server deployment.
- Pillow constraint: MindSpider pins `Pillow>=10.0.0,<11` for Streamlit compatibility.