$ show cv-cat/XHS_ALL_IN_ONE
This repository implements a full-stack content operations platform exclusively for Xiaohongshu (XHS), the Chinese social media platform. It provides a complete lifecycle for managing XHS notes: discovering content via search or URL crawling, saving to a local library, AI-assisted rewriting and title/tag generation, scheduling and publishing through XHS's Creator API, and monitoring engagement metrics. The system is built as a modern web application with a FastAPI backend (Python) and a React frontend (TypeScript, Ant Design), using SQLAlchemy for persistence and APScheduler for background job execution. The architecture is a monolith with clear separation of concerns: backend API routers for accounts, notes, drafts, AI, tasks, publishing, monitoring, and analytics; a service layer for business logic; and a set of adapters that encapsulate the reverse-engineered XHS API clients. The frontend provides a dashboard, discovery page, content library, draft editor, publish center, auto-ops scheduler, and analytics views. Authentication uses JWT tokens with refresh logic, and the system supports multiple XHS account types (PC web and Creator) via QR code or phone login. A notable aspect is the extensive reverse-engineering of XHS's anti-bot mechanisms. The codebase includes custom JavaScript modules for generating signatures (b1, MNS, X-S, X-T, websectiga, profileData) and browser fingerprint emulation, all executed locally via Node.js subprocesses. This allows the platform to interact with XHS APIs without a real browser, enabling automated content operations at scale. While the primary focus is on XHS, the platform abstraction layer (PlatformId enum, adapter interfaces) suggests an intention to support other social media platforms, though only XHS is currently implemented. The repository is a hybrid of application and data engineering: it is primarily a production-grade web application with scheduled tasks, user management, and a rich UI, but it also contains data pipeline elements such as crawling, normalization, and storage of XHS content for later analysis. The data models and analytics endpoints provide research-like capabilities (keyword tracking, engagement trends, benchmarks), but these are embedded within the application rather than forming a standalone data research project.
The LLM identified 4 files worth highlighting for reuse:
A self-contained rate limiter class (CrawlRateLimiter) that uses a sliding window approach with asyncio locks. It can be extracted and reused in any Python project requiring per-key rate limiting (e.g., API clients, web scrapers). The implementation is clean, thread-safe, and parameterized with max requests and window duration.
Encapsulates the XHS authentication state machine for both PC and Creator platforms. It manages cookie acquisition, token refresh, and device profile generation. The module demonstrates deep reverse-engineering of XHS's anti-bot flow (QR login, phone login, security bootstrap) and is isolated enough to be reused in other XHS automation projects with minimal adaptation.
Provides reusable image manipulation functions: compose_cover_image (overlays text on images), resize_image_file, and image format conversion. Uses OpenCV and Pillow. These functions are self-contained, well-documented, and can be extracted for any project needing programmatic image composition or resizing.
A centralized Axios-based API client with automatic JWT token refresh, request/response interceptors, and error handling. It manages access and refresh tokens, retries on 401, and provides typed API functions for all backend endpoints. This pattern is reusable in any React application requiring authenticated API communication.