LeoYeAI/agent-master-skills / skills/1688-product-search
1688-product-search
Verified1688商品搜索SKILL:提供完整的1688商品搜索能力,包括类目查询、关键词搜索、图片搜索、商品详情、相关性商品、拉取货盘底池等9个核心接口。 支持多语言搜索和商品推荐,使用1688开放平台官方API,统一鉴权,Token全局缓存共享。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 17.9 KB |
| _meta.json | config | 295 B |
| references/api.md | markdown | 3.4 KB |
| scripts/auth.py | script | 4.2 KB |
| scripts/auth_fixed.py | script | 4.9 KB |
| scripts/fixed_image_upload.py | script | 3.5 KB |
| scripts/image_search_handler.py | script | 6.2 KB |
| scripts/image_utils.py | script | 2.7 KB |
| scripts/product_search.py | script | 27.4 KB |
| scripts/product_search_fixed.py | script | 3.8 KB |
| scripts/product_search_updated.py | script | 19.7 KB |
| scripts/smart_recommend.py | script | 3.2 KB |
scripts/smart_recommend.py
View on GitHub#!/usr/bin/env python3
"""
1688 智能推荐处理器
自动处理用户关于推荐商品的请求
"""
import os
import sys
import json
import argparse
import subprocess
# 添加 scripts 目录到 Python 路径
sys.path.insert(0, os.path.dirname(__file__))
def get_app_credentials():
"""获取应用凭证"""
app_key = os.getenv('ALI1688_APP_KEY')
app_secret = os.getenv('ALI1688_APP_SECRET')
refresh_token = os.getenv('ALI1688_REFRESH_TOKEN')
access_token = os.getenv('ALI1688_ACCESS_TOKEN')
if not app_key or not app_secret:
raise Exception("Missing ALI1688_APP_KEY or ALI1688_APP_SECRET")
return app_key, app_secret, refresh_token, access_token
def smart_recommend(query=None, category_id=None, country='en', page_size=20):
"""
智能推荐商品
- 如果有具体查询词,使用关键词推荐
- 如果有类目ID,使用类目推荐
- 如果都没有,使用通用推荐
"""
try:
# 获取凭证验证
get_app_credentials()
if category_id:
# 如果有类目ID,先获取类目名称,然后用类目名称做推荐
result = subprocess.run([
sys.executable, 'product_search.py', 'category', str(category_id), '--language', 'zh'
], capture_output=True, text=True, cwd=os.path.dirname(__file__))
if result.returncode == 0:
category_data = json.loads(result.stdout)
if category_data.get('result', {}).get('chineseName'):
category_name = category_data['result']['chineseName']
query = category_name
# 如果没有查询词,使用通用关键词
if not query:
query = "热门商品"
# 调用 offer-recommend 接口
result = subprocess.run([
sys.executable, 'product_search.py', 'offer-recommend', query,
'--country', country, '--pageSize', str(page_size)
], capture_output=True, text=True, cwd=os.path.dirname(__file__))
if result.returncode == 0:
return json.loads(result.stdout)
else:
error_msg = result.stderr if result.stderr else "Unknown error"
raise Exception(f"Recommendation failed: {error_msg}")
except Exception as e:
return {'error': str(e)}
def main():
parser = argparse.ArgumentParser(description='1688 Smart Recommendation')
parser.add_argument('--query', help='Search query or category name')
parser.add_argument('--category-id', type=int, help='Category ID for recommendation')
parser.add_argument('--country', default='en', help='Country/language code')
parser.add_argument('--page-size', type=int, default=20, help='Number of results')
args = parser.parse_args()
try:
result = smart_recommend(
query=args.query,
category_id=args.category_id,
country=args.country,
page_size=args.page_size
)
print(json.dumps(result, ensure_ascii=False, indent=2))
except Exception as e:
print(json.dumps({'error': str(e)}, ensure_ascii=False, indent=2))
sys.exit(1)
if __name__ == "__main__":
main()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 | Unverified | 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: 322k | 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: 322k | 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: 322k | Updated | Claude CodeCodex | Verified | Install |