- 新增小红书前端模块(启动服务、内容分析、爆款创作、发布记录、技能卡片、拟人设置、AI 助手) - 新增 xhs-agent-desktop 独立桌面 Agent,对接 OMS 任务调度 - 登录页重构,整合微信登录与 OMS JWT 认证 - 订单、渠道、用户中心等页面与 API 增强 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""小红书 URL 常量和构建函数。"""
|
||
|
||
from urllib.parse import urlencode
|
||
|
||
# 基础页面
|
||
EXPLORE_URL = "https://www.xiaohongshu.com/explore"
|
||
HOME_URL = "https://www.xiaohongshu.com"
|
||
PUBLISH_URL = "https://creator.xiaohongshu.com/publish/publish?source=official"
|
||
|
||
|
||
def make_feed_detail_url(feed_id: str, xsec_token: str = "") -> str:
|
||
"""构建 feed 详情页 URL。xsec_token 为列表/详情接口返回的访问凭证,浏览器打开笔记页时仍需要。"""
|
||
base = f"https://www.xiaohongshu.com/explore/{feed_id}"
|
||
token = (xsec_token or "").strip()
|
||
if not token:
|
||
return base
|
||
return f"{base}?xsec_token={token}&xsec_source=pc_feed"
|
||
|
||
|
||
def make_search_url(keyword: str) -> str:
|
||
"""构建搜索结果页 URL(与小红书搜索页当前 source 参数一致)。"""
|
||
params = urlencode({"keyword": keyword, "source": "web_search_result_notes"})
|
||
return f"https://www.xiaohongshu.com/search_result?{params}"
|
||
|
||
|
||
def make_user_profile_url(user_id: str, xsec_token: str = "") -> str:
|
||
"""构建用户主页 URL。"""
|
||
base = f"https://www.xiaohongshu.com/user/profile/{user_id}"
|
||
token = (xsec_token or "").strip()
|
||
if not token:
|
||
return base
|
||
return f"{base}?xsec_token={token}&xsec_source=pc_note"
|