OpenSenseNova/SenseNova-Skills / skills/sn-search-social-cn
sn-search-social-cn
Verified用于搜索中文社交平台。脚本入口覆盖 B站视频、知乎问答和抖音视频;小红书、微博当前没有脚本入口,只能通过 browser-use / 公开网页兜底。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.0 KB |
| requirements.txt | manifest | 16 B |
| scripts/bilibili_search.py | script | 3.5 KB |
| scripts/douyin_search.py | script | 2.9 KB |
| scripts/search_utils.py | script | 4.3 KB |
| scripts/zhihu_search.py | script | 6.7 KB |
scripts/douyin_search.py
View on GitHub#!/usr/bin/env python3
"""抖音搜索。通过抖音 Web API(需要 cookie 认证,稳定性较低)。"""
import sys
from search_utils import build_parser, get_client, get_key, make_item, make_result, print_json
SEARCH_URL = "https://www.douyin.com/aweme/v1/web/general/search/single/"
def search(query: str, limit: int, cookie: str | None = None) -> list[dict]:
"""执行抖音搜索。
注意:抖音反爬较严格,此脚本稳定性较低,可能需要频繁更新 cookie。
"""
if not cookie:
raise ValueError("需要 DOUYIN_COOKIE 环境变量。请从浏览器开发者工具获取抖音 cookie。")
headers = {
"Cookie": cookie,
"Referer": "https://www.douyin.com/search/" + query,
"Origin": "https://www.douyin.com",
}
params = {
"keyword": query,
"search_channel": "aweme_general",
"sort_type": 0, # 0=综合, 1=最多点赞, 2=最新发布
"publish_time": 0, # 0=不限, 1=一天内, 7=一周内, 182=半年内
"count": min(limit, 20),
"offset": 0,
"need_filter_settings": 0,
"device_platform": "webapp",
"aid": 6383,
}
with get_client(timeout=20, headers=headers) as client:
resp = client.get(SEARCH_URL, params=params)
resp.raise_for_status()
data = resp.json()
status_code = data.get("status_code", -1)
if status_code != 0:
msg = data.get("status_msg") or f"status_code={status_code}"
raise RuntimeError(f"抖音 API 错误: {msg}")
items = []
for entry in data.get("data", [])[:limit]:
aweme = entry.get("aweme_info", entry)
if not aweme:
continue
desc = aweme.get("desc", "")
aweme_id = aweme.get("aweme_id", "")
author = aweme.get("author", {}) or {}
stats = aweme.get("statistics", {}) or {}
items.append(make_item(
title=desc[:100],
url=f"https://www.douyin.com/video/{aweme_id}" if aweme_id else "",
snippet=desc[:300],
author=author.get("nickname", ""),
digg_count=stats.get("digg_count", 0),
comment_count=stats.get("comment_count", 0),
share_count=stats.get("share_count", 0),
play_count=stats.get("play_count", 0),
create_time=aweme.get("create_time"),
))
return items
def main():
parser = build_parser("搜索抖音视频")
parser.add_argument("--cookie", help="抖音 Cookie(也可通过 DOUYIN_COOKIE 环境变量设置)")
args = parser.parse_args()
cookie = get_key("DOUYIN_COOKIE", args.cookie)
try:
items = search(args.query, args.limit, cookie)
print_json(make_result(True, args.query, "douyin", items))
except Exception as e:
print_json(make_result(False, args.query, "douyin", [], str(e)))
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |