Skill: deanzh0912/sexy-claw (version 1.0.0)

--- name: sexy-Claw description: > 🦞 色😍龙虾 - 根据主人审美偏好，在多个平台（小红书、抖音、YouTube、B站）搜索并推荐颜值博主/视频。 自动获取用户cookies，学习主人喜好，推送个性化内容。 使用场景： - 主人说"找美女/小姐姐/颜值博主" - 主人提到特定平台（小红书/抖音/YouTube/B站） - 主人给出审美偏好（如"喜欢 habin/leeesovely 这种类型"） - 主人要求"推荐类似 XXX 的博主" 触发词：找美女、搜小姐姐、颜值博主、推荐博主、habin、leeesovely、 小红书美女、抖音美女、B站小姐姐、YouTube美女、色龙虾 --- # 🦞 Sexy-Claw 色😍龙虾 根据主人审美品味，在多个社交平台搜索并推荐颜值博主/视频。 > "让每一次搜索都充满惊喜 😍" ## 工作流程 ### 1. 获取主人审美偏好 首次使用时，询问主人： - 喜欢什么类型？（甜美/御姐/清纯/性感/可爱...） - 有喜欢的博主吗？（habin/leeesovely/真栗/兔娘...） - 偏好哪个平台？（小红书/抖音/YouTube/B站） 将偏好保存到 `references/user_preference.json` ### 2. 获取平台 Cookies 如果主人未提供 cookies，引导主人获取： **小红书**： ``` 1. 登录 https://www.xiaohongshu.com 2. F12 → Application → Cookies 3. 复制 web_session, a1 等关键字段 ``` **抖音**： ``` 1. 登录 https://www.douyin.com 2. F12 → Application → Cookies 3. 复制 sessionid, ttwid 等关键字段 ``` **B站**： ``` 1. 登录 https://www.bilibili.com 2. F12 → Application → Cookies 3. 复制 SESSDATA, bili_jct 等关键字段 ``` **YouTube**： - 通常不需要 cookies，直接搜索即可 将 cookies 保存到 `references/platform_cookies.json` ### 3. 搜索推荐 根据主人偏好，在对应平台搜索： ```bash # 小红书 python3 scripts/xhs_search.py "关键词" 10 # 抖音 python3 scripts/douyin_search.py "关键词" 10 # B站 python3 scripts/bilibili_search.py "关键词" 10 # YouTube yt-dlp --dump-json "ytsearch5:关键词" ``` ### 4. 打开视频 将搜索结果按播放量/点赞排序，打开前3-5个最热门的视频： ```bash open "视频链接" ``` ## 平台支持 | 平台 | 状态 | 需要的 Cookies | |------|------|----------------| | 小红书 | ✅ | web_session, a1 | | 抖音 | ✅ | sessionid, ttwid | | B站 | ✅ | SESSDATA, bili_jct | | YouTube | ✅ | 无需 | ## 脚本使用 ### 搜索小红书 ```bash python3 scripts/xhs_search.py "颜值 美女" 10 ``` ### 搜索抖音 ```bash python3 scripts/douyin_search.py "美女" 10 ``` ### 搜索B站 ```bash python3 scripts/bilibili_search.py "真栗" 10 ``` ### 获取用户视频 ```bash python3 scripts/bilibili_search.py user 129641517 5 ``` ## 主人偏好记录 保存在 `references/user_preference.json`： ```json { "preferred_type": ["御姐", "甜美"], "favorite_creators": ["habin", "leeesovely", "真栗"], "preferred_platforms": ["抖音", "B站"], "last_search": "2024-01-01", "search_history": [] } ``` ## Cookies 记录 保存在 `references/platform_cookies.json`： ```json { "xiaohongshu": { "web_session": "xxx", "a1": "xxx" }, "douyin": { "sessionid": "xxx", "ttwid": "xxx" }, "bilibili": { "SESSDATA": "xxx", "bili_jct": "xxx" } } ``` ## 注意事项 1. **隐私保护**：cookies 只保存在本地，不上传 2. **定期更新**：cookies 会过期，需要定期重新获取 3. **频率控制**：避免频繁搜索，防止触发平台风控 4. **主人确认**：首次使用需主人明确同意保存偏好和cookies --- 🦞 **色龙虾，让美好触手可及** 😍

path: scripts/xhs_search.py
content: #!/usr/bin/env python3
"""
小红书搜索脚本
"""
import json
import sys
import subprocess

def search_xhs(keyword, num=10):
    """使用 xhs-cli 搜索"""
    cmd = f'source ~/.agent-reach-venv/bin/activate && xhs search "{keyword}" --sort popular --json'
    result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
    
    try:
        data = json.loads(result.stdout)
        items = [i for i in data.get('data', {}).get('items', []) if i.get('model_type') == 'note']
        
        results = []
        for item in items[:num]:
            note = item.get('note_card', {})
            interact = note.get('interact_info', {})
            user = note.get('user', {})
            
            results.append({
                'title': note.get('display_title', ''),
                'nickname': user.get('nickname', ''),
                'likes': interact.get('liked_count', '0'),
                'comments': interact.get('comment_count', '0'),
                'note_id': item.get('id', ''),
                'link': f"https://www.xiaohongshu.com/explore/{item.get('id', '')}",
            })
        return results
    except Exception as e:
        return {'error': str(e)}

if __name__ == '__main__':
    keyword = sys.argv[1] if len(sys.argv) > 1 else '美女'
    num = int(sys.argv[2]) if len(sys.argv) > 2 else 10
    
    results = search_xhs(keyword, num)
    print(json.dumps(results, ensure_ascii=False, indent=2))


path: scripts/bilibili_search.py
content: #!/usr/bin/env python3
"""
B站搜索脚本
"""
import json
import sys
import requests
import urllib.parse

def load_cookies():
    """从文件加载 cookies"""
    try:
        with open('../references/platform_cookies.json', 'r') as f:
            data = json.load(f)
            return data.get('bilibili', {})
    except:
        return {}

def search_bilibili(keyword, num=10):
    """搜索B站视频"""
    cookies = load_cookies()
    
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
        'Accept': 'application/json, text/plain, */*',
        'Referer': f'https://search.bilibili.com/all?keyword={urllib.parse.quote(keyword)}',
    }
    
    api_url = 'https://api.bilibili.com/x/web-interface/search/type'
    params = {
        'search_type': 'video',
        'keyword': keyword,
        'page': '1',
        'pagesize': str(num),
        'order': 'click',
    }
    
    try:
        session = requests.Session()
        resp = session.get(api_url, headers=headers, params=params, cookies=cookies, timeout=15)
        data = resp.json()
        
        if data.get('code') == 0:
            videos = data.get('data', {}).get('result', [])
            results = []
            for v in videos[:num]:
                results.append({
                    'title': v.get('title', '').replace('<em class="keyword">', '').replace('</em>', ''),
                    'bvid': v.get('bvid', ''),
                    'link': f"https://www.bilibili.com/video/{v.get('bvid', '')}",
                    'author': v.get('author', ''),
                    'mid': v.get('mid', ''),
                    'play': v.get('play', 0),
                    'danmaku': v.get('danmaku', 0),
                })
            return results
        else:
            return {'error': data.get('message', 'Unknown error')}
    except Exception as e:
        return {'error': str(e)}

def get_user_videos(mid, num=5):
    """获取用户视频列表"""
    cookies = load_cookies()
    
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
        'Accept': 'application/json, text/plain, */*',
        'Referer': f'https://space.bilibili.com/{mid}',
    }
    
    api_url = 'https://api.bilibili.com/x/space/arc/search'
    params = {
        'mid': str(mid),
        'ps': str(num),
        'tid': '0',
        'pn': '1',
        'order': 'click',
    }
    
    try:
        session = requests.Session()
        resp = session.get(api_url, headers=headers, params=params, cookies=cookies, timeout=15)
        data = resp.json()
        
        if data.get('code') == 0:
            videos = data.get('data', {}).get('list', {}).get('vlist', [])
            results = []
            for v in videos[:num]:
                results.append({
                    'title': v.get('title', ''),
                    'bvid': v.get('bvid', ''),
                    'link': f"https://www.bilibili.com/video/{v.get('bvid', '')}",
                    'play': v.get('play', 0),
                    'comment': v.get('comment', 0),
                })
            return results
        else:
            return {'error': data.get('message', 'Unknown error')}
    except Exception as e:
        return {'error': str(e)}

if __name__ == '__main__':
    if len(sys.argv) > 1 and sys.argv[1] == 'user':
        mid = sys.argv[2] if len(sys.argv) > 2 else '129641517'
        num = int(sys.argv[3]) if len(sys.argv) > 3 else 5
        results = get_user_videos(mid, num)
    else:
        keyword = sys.argv[1] if len(sys.argv) > 1 else '美女'
        num = int(sys.argv[2]) if len(sys.argv) > 2 else 10
        results = search_bilibili(keyword, num)
    
    print(json.dumps(results, ensure_ascii=False, indent=2))


path: scripts/douyin_search.py
content: #!/usr/bin/env python3
"""
抖音搜索脚本
"""
import json
import sys
import requests
import urllib.parse

def load_cookies():
    """从文件加载 cookies"""
    try:
        with open('../references/platform_cookies.json', 'r') as f:
            data = json.load(f)
            return data.get('douyin', {})
    except:
        return {}

def search_douyin(keyword, num=10):
    """搜索抖音视频"""
    cookies = load_cookies()
    if not cookies:
        return {'error': 'No cookies found. Please provide Douyin cookies first.'}
    
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
        'Accept': 'application/json, text/plain, */*',
        'Referer': f'https://www.douyin.com/search/{urllib.parse.quote(keyword)}',
    }
    
    api_url = 'https://www.douyin.com/aweme/v1/web/search/item/'
    params = {
        'device_platform': 'webapp',
        'aid': '6383',
        'channel': 'channel_pc_web',
        'search_channel': 'aweme',
        'keyword': keyword,
        'offset': '0',
        'count': str(num),
    }
    
    try:
        session = requests.Session()
        resp = session.get(api_url, headers=headers, params=params, cookies=cookies, timeout=15)
        data = resp.json()
        
        if data.get('status_code') == 0:
            videos = data.get('data', [])
            results = []
            for v in videos[:num]:
                aweme = v.get('aweme_info', {})
                author = aweme.get('author', {})
                stats = aweme.get('statistics', {})
                
                results.append({
                    'desc': aweme.get('desc', '')[:50],
                    'nickname': author.get('nickname', ''),
                    'digg_count': stats.get('digg_count', 0),
                    'comment_count': stats.get('comment_count', 0),
                    'aweme_id': aweme.get('aweme_id', ''),
                    'link': f"https://www.douyin.com/video/{aweme.get('aweme_id', '')}",
                })
            return results
        else:
            return {'error': data.get('status_msg', 'Unknown error')}
    except Exception as e:
        return {'error': str(e)}

if __name__ == '__main__':
    keyword = sys.argv[1] if len(sys.argv) > 1 else '美女'
    num = int(sys.argv[2]) if len(sys.argv) > 2 else 10
    
    results = search_douyin(keyword, num)
    print(json.dumps(results, ensure_ascii=False, indent=2))


path: scripts/youtube_search.py
content: #!/usr/bin/env python3
"""
YouTube搜索脚本
"""
import json
import sys
import subprocess

def search_youtube(keyword, num=5):
    """搜索 YouTube 视频"""
    cmd = f'yt-dlp --dump-json "ytsearch{num}:{keyword}"'
    result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
    
    results = []
    for line in result.stdout.strip().split('\n'):
        if line:
            try:
                data = json.loads(line)
                results.append({
                    'title': data.get('title', ''),
                    'uploader': data.get('uploader', ''),
                    'view_count': data.get('view_count', 0),
                    'url': data.get('webpage_url', ''),
                    'duration': data.get('duration_string', ''),
                })
            except:
                pass
    
    # 按播放量排序
    results.sort(key=lambda x: x['view_count'], reverse=True)
    return results[:num]

if __name__ == '__main__':
    keyword = sys.argv[1] if len(sys.argv) > 1 else 'beautiful girl'
    num = int(sys.argv[2]) if len(sys.argv) > 2 else 5
    
    results = search_youtube(keyword, num)
    print(json.dumps(results, ensure_ascii=False, indent=2))


path: references/platform_cookies.json
content: {
  "xiaohongshu": {},
  "douyin": {},
  "bilibili": {},
  "youtube": {}
}


path: references/user_preference.json
content: {
  "preferred_type": [],
  "favorite_creators": [],
  "preferred_platforms": [],
  "last_search": "",
  "search_history": []
}


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)