feat: improve Xiaohongshu authentication with automatic cookie persis… #773
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…tence
This commit implements a comprehensive improvement to the Xiaohongshu (小红书) authentication system to avoid repeated QR code scanning on every run.
Key Features
Automatic Cookie Management
New CookieManager Class
cookies/xhs_cookies.jsonEnhanced Login Flow
pong()check before useweb_sessionNew Configuration Option
AUTO_SAVE_AND_USE_COOKIES(default: True)Changes
New Files
media_platform/xhs/cookie_manager.py: Cookie persistence utilitydocs/xiaohongshu_auth_improvement.md: English documentationdocs/xiaohongshu_auth_improvement_zh.md: Chinese documentationModified Files
media_platform/xhs/login.py: Enhanced cookie login, auto-save after loginmedia_platform/xhs/core.py: Improved authentication flow with cookie priorityconfig/base_config.py: Added AUTO_SAVE_AND_USE_COOKIES option.gitignore: Added/cookies/directory to prevent cookie commitsBenefits
Before: Scan QR code every single run ❌
After: Scan QR code only once, then automatic authentication ✅
Security
Documentation
Comprehensive documentation provided in both English and Chinese, including:
Resolves the issue of repeated QR code authentication and significantly improves user experience for Xiaohongshu URL crawling.