xiaohongshu-skills
Verified小红书(RedNote / Xiaohongshu / XHS / RED / Little Red Book)浏览器自动化技能集合。 支持认证登录、内容发布、搜索发现、账号与评论分析、社交互动和复合运营。 当用户提到小红书、红书、RedNote、Xiaohongshu、XHS、RED、Little Red Book, 或要求发笔记、搜笔记、分析博主、评论、登录、点赞、收藏时触发。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.0 KB |
| scripts/bridge_server.py | script | 5.7 KB |
| scripts/cli.py | script | 49.7 KB |
| scripts/image_downloader.py | script | 4.6 KB |
| scripts/run_lock.py | script | 2.7 KB |
| scripts/title_utils.py | script | 1.7 KB |
| scripts/video_processor.py | script | 7.5 KB |
| scripts/xhs/__init__.py | script | 42 B |
| scripts/xhs/bridge.py | script | 14.0 KB |
| scripts/xhs/cdp.py | script | 27.4 KB |
| scripts/xhs/comment.py | script | 5.8 KB |
| scripts/xhs/cookies.py | script | 1.5 KB |
| scripts/xhs/errors.py | script | 2.3 KB |
| scripts/xhs/feed_detail.py | script | 23.2 KB |
| scripts/xhs/feeds.py | script | 1.1 KB |
| scripts/xhs/human.py | script | 2.1 KB |
| scripts/xhs/like_favorite.py | script | 6.4 KB |
| scripts/xhs/local_discovery.py | script | 2.9 KB |
| scripts/xhs/login.py | script | 11.1 KB |
| scripts/xhs/publish.py | script | 31.9 KB |
| scripts/xhs/publish_long_article.py | script | 8.2 KB |
| scripts/xhs/publish_video.py | script | 4.4 KB |
| scripts/xhs/risk_analyzer.py | script | 11.0 KB |
| scripts/xhs/search.py | script | 6.2 KB |
| scripts/xhs/selectors.py | script | 3.4 KB |
| scripts/xhs/types.py | script | 14.6 KB |
| scripts/xhs/urls.py | script | 958 B |
| scripts/xhs/user_profile.py | script | 9.9 KB |
scripts/xhs/local_discovery.py
View on GitHub"""基于小红书当前浏览器会话的本地内容发现。"""
from __future__ import annotations
from .cdp import Page
from .search import search_feeds
from .types import Feed, FilterOption
_ALLOWED_SCOPES = {"同城", "附近"}
def _account_from_feed(feed: Feed) -> dict | None:
"""将一条公开笔记压缩为账号及其首条样本笔记。"""
item = feed.to_dict()
user = item.get("user") or {}
user_id = str(user.get("userId") or "").strip()
nickname = str(user.get("nickname") or "").strip()
# 热搜推荐等非笔记卡片没有稳定账号,不应混进账号发现结果。
if not user_id or not nickname:
return None
sample = {
"feedId": item["id"],
"xsecToken": item["xsecToken"],
"title": item.get("displayTitle", ""),
"type": item.get("type", ""),
"interactInfo": item.get("interactInfo", {}),
}
if item.get("cover"):
sample["cover"] = item["cover"]
if item.get("video"):
sample["video"] = item["video"]
return {"userId": user_id, "nickname": nickname, "sampleNote": sample}
def unique_accounts_from_feeds(feeds: list[Feed], limit: int) -> list[dict]:
"""按账号去重,保留其在当前结果中的首条样本笔记。"""
accounts: list[dict] = []
seen_user_ids: set[str] = set()
for feed in feeds:
account = _account_from_feed(feed)
if not account or account["userId"] in seen_user_ids:
continue
seen_user_ids.add(account["userId"])
accounts.append(account)
if len(accounts) >= limit:
break
return accounts
def browse_local_accounts(
page: Page,
keyword: str,
*,
scope: str = "同城",
limit: int = 30,
sort_by: str = "综合",
) -> dict:
"""以小红书当前会话的本地筛选浏览并返回去重的公开账号。"""
if scope not in _ALLOWED_SCOPES:
choices = "、".join(sorted(_ALLOWED_SCOPES))
raise ValueError(f"本地范围必须是 {choices},实际为: {scope}")
if not 1 <= limit <= 100:
raise ValueError("--limit 必须在 1 到 100 之间")
feeds = search_feeds(page, keyword, FilterOption(sort_by=sort_by, location=scope))
accounts = unique_accounts_from_feeds(feeds, limit)
return {
"keyword": keyword,
"localContext": {
"mode": scope,
"source": "小红书当前浏览器会话自动定位",
"city": None,
"cityStatus": "已应用本地筛选;页面未暴露可可靠读取的城市名称。",
},
"accounts": accounts,
"count": len(accounts),
"requestedLimit": limit,
"warning": (
"结果仅为关键词命中的公开账号,未验证账号主体的身份、年龄、性别或外貌;"
"本地范围由小红书当前会话决定,不能视为精确位置。"
),
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |