运行时依赖
安装命令
点击复制技能文档
游戏市场技能查询 直接在聊天中浏览YY游戏交易市场列表。 按游戏→类别→列表→分页浏览。 当用户想要实际购买或出售时,确认后打开浏览器。 无需登录。 API使用前端签名(基于MD5),自成体系。
何时激活 当用户: 手动运行/game-market 提及游戏交易关键词:游戏账号、买/卖账号、提升、指导、游戏货币、游戏物品 提及特定游戏名称:王者荣耀、英雄联盟、三角洲行动、和平精英、穿越火线、无畏契约、绝地求生、崩坏、原神、CSGO 提及YY市场:YY交易、YY商城、mall.yy.com
工作流程 步骤1 — 意图识别 从用户输入中提取: 游戏名称→categoryId 子类别→subCategoryId 子类别subCategoryId 账号(Account)5 代练(Boosting)1 陪练(Coaching)2 道具(Items)3 游戏币(Currency)4 如果意图不明确(游戏提及但无类别,或反之),则转到步骤2。
步骤2 — 类别选择(当意图不明确) 运行以下Python代码片段以获取和显示类别:
import hashlib, uuid, time, requests
APPID = "market_app"
SECRET = "ixlOJVDwdOm5rGdudhEywwK6"
HDID = "38e6a82f5f724517d6cbe82cde56e846690afcb0"
BASE = "https://gamemarket.yy.com"
def sign(uri):
nonce = str(uuid.uuid4())
ts = str(int(time.time() 1000))
raw = f"appId={APPID}&nonce={nonce}×tamp={ts}&uri={uri}&secret={SECRET}"
sig = hashlib.md5(raw.encode()).hexdigest()
return {
"accept": "application/json, text/plain, /",
"origin": "https://mall.yy.com",
"referer": "https://mall.yy.com/",
"user-agent": "Mozilla/5.0",
"x-appid": APPID,
"x-nonce": nonce,
"x-timestamp": ts,
"x-signature": sig,
}
uri = "/category/queryShowCategories"
resp = requests.get(BASE + uri, params={"sid": "", "hdid": HDID}, headers=sign(uri), timeout=15)
cats = resp.json()["data"]
for c in cats:
subs = ", ".join(s["name"] for s in c.get("subCategories", []))
print(f" {c['id']:>2}. {c['name']} ({subs})")
向用户呈现列表并要求选择游戏和子类别。 步骤3 — 查询列表 使用以下Python代码片段运行已解析的category_id和sub_category_id: ```python import hashlib, uuid, time, requests APPID = "market_app" SECRET = "ixlOJVDwdOm5rGdudhEywwK6" HDID = "38e6a82f5f724517d6cbe82cde56e846690afcb0" BASE = "https://gamemarket.yy.com" def sign(uri): nonce = str(uuid.uuid4()) ts = str(int(time.time() 1000)) raw = f"appId={APPID}&nonce={nonce}×tamp={ts}&uri={uri}&secret={SECRET}" sig = hashlib.md5(raw.encode()).hexdigest() return { "accept": "application/json, text/plain, /", "origin": "https://mall.yy.com", "referer": "https://mall.yy.com/", "user-agent": "Mozilla/5.0", "x-appid": APPID, "x-nonce": nonce, "x-timestamp": ts, "x-signature": sig, } # ---- 设置以下内容,然后运行 ---- category_id = 5 # None = 所有游戏 sub_category_id = 5 page_num = 1 # ---------------------------------- uri = "/goods/v2/search" params = { "pageNum": str(page_num), "pageSize": "20", "requestSource": "HOME", "withRegionServer": "true", "hdid": HDID, "subCategoryId": str(sub_category_id), "searchDistChannelGoods": "false", } if category_id is not None: params["categoryId"] = str(category_id) resp = requests.get(BASE + uri, params=params, headers=sign(uri), timeout=15) result = resp.json()["data"] goods = result.get("goodsList", []) total = result.get("totalCount", 0) print(f"总计:{total}个列表 | 第{page_num}页\n") for i, g in enumerate(goods, 1): price = g["salePrice"] / 100 name = g["goodsName"].replace("\r\n", " ").replace("\n", " ")[:80] labels = " ".join(lb["labelName"] for lb in g.get("goodsLabels", [])) gid = g["goodsId"] cat = g.get("categoryName", "") sub = g.get("subCategoryName", "") url = f"https://mall.yy.com/?pageId=20000#/shop/detail/{gid}" print(f"[{i:02d}] ¥{price:.0f} {cat} · {sub}") print(f" {name}") if labels: print(f" 【{labels}】") print(f" 🔗 {url}\n")
步骤4 — 后续交互 在显示结果后继续监听: 用户说动作 "下一页" / "更多" / "下一页" 递增page_num,重新运行步骤3 "项目N" / "打开#3" / "第N条" 在浏览器中打开该项目的详细URL "更换游戏" / "换个游戏" 回到步骤1 "购买" / "购买" / "想买" → 买/卖流程 "出售" / "出售" / "想卖" → 买/卖流程
买/卖流程 当用户表达购买或出售意图时: 用确认提示回复: 要购买或出售,您需要使用YY市场网站。现在打开它? 如果用户确认,则运行: # 打开YY市场主页 open "https://mall.yy.com/?pageId=20000" 如果用户对特定项目感兴趣,则打开其详细页面: open "https://mall.yy.com/?pageId=20000#/shop/detail/{goodsId}"
错误处理 情况响应 API请求失败/超时 "查询失败。请访问https://mall.yy.com"