SM Saver
Extracts, summarizes, and logs resources from social media posts or direct URLs.
Output log
Append all saved entries to ~/workspace/resources.md (create if missing).
Workflow
1. Detect source type
| Pattern | Type |
|---|
| INLINECODE1 or INLINECODE2 | Twitter/X post |
| INLINECODE3 |
LinkedIn post |
| Anything else | Direct URL |
2. Fetch content
Twitter/X — use xurl:
CODEBLOCK0
Parse the JSON response:
- - Extract
data.text (tweet body) - Extract
data.entities.urls[].expanded_url (linked resources, skip t.co self-references and pic.twitter.com) - Extract
data.author_id or author handle if available
LinkedIn / Direct URL — skip to step 3 directly with the URL itself as the resource.
3. Summarize each resource
For each extracted URL (or the URL itself if direct):
CODEBLOCK1
If summarize is not installed, fall back to:
CODEBLOCK2
If a URL is inaccessible (auth wall, timeout), note it as [inaccessible] and continue.
4. Append to resources.md
Format — strict, no deviation:
CODEBLOCK3
INLINECODE11 :
- - Twitter:
@{handle} if extractable, else INLINECODE13 - LinkedIn: INLINECODE14
- Direct: domain name (e.g.
github.com)
5. Confirm to user
Respond with exactly:
CODEBLOCK4
If nothing was extractable: INLINECODE16
Examples
| User says | Source type | Result |
|---|
| "https://x.com/karpathy/status/123456" | Twitter/X | Extract tweet text + linked URLs, summarize each, append to INLINECODE17 |
| "https://linkedin.com/posts/someone-123" |
LinkedIn | Fetch page, summarize, append to
resources.md |
| "Save this: https://github.com/anthropics/claude-code" | Direct URL | Fetch title + summary, append to
resources.md |
| "https://x.com/elonmusk/status/789 garde ça" | Twitter/X | Extract tweet + linked resources, summarize, append to
resources.md |
SM Saver
从社交媒体帖子或直接URL中提取、总结并记录资源。
输出日志
将所有保存的条目追加到 ~/workspace/resources.md(若文件不存在则创建)。
工作流程
1. 检测来源类型
| 模式 | 类型 |
|---|
| x.com/ 或 twitter.com/ | Twitter/X 帖子 |
| linkedin.com/* |
LinkedIn 帖子 |
| 其他任何内容 | 直接URL |
2. 获取内容
Twitter/X — 使用 xurl:
json
{
tool: exec,
command: xurl read
}
解析JSON响应:
- - 提取 data.text(推文正文)
- 提取 data.entities.urls[].expandedurl(链接资源,跳过 t.co 自引用和 pic.twitter.com)
- 提取 data.authorid 或作者用户名(如可用)
LinkedIn / 直接URL — 直接使用URL本身作为资源,跳至步骤3。
3. 总结每个资源
对于每个提取的URL(如果是直接URL则为该URL本身):
json
{
tool: exec,
command: summarize \\ --length short
}
如果未安装 summarize,则回退到:
json
{
tool: exec,
command: python3 -c \\nimport urllib.request, sys\nreq = urllib.request.Request(, headers={User-Agent: Mozilla/5.0})\nwith urllib.request.urlopen(req, timeout=10) as r:\n html = r.read().decode(utf-8, errors=ignore)\nimport re\ntitle = re.search(r(.*?), html, re.I)\nprint(title.group(1).strip() if title else )\n\
}
如果URL无法访问(认证墙、超时),则标记为 [inaccessible] 并继续。
4. 追加到 resources.md
格式 — 严格,不得偏离:
markdown
{YYYY-MM-DD} · {来源标签}
{推文文本或帖子首句 — 最多120字符,超出用…截断}
{对于每个资源:}
来源标签:
- - Twitter:@{用户名}(如可提取),否则为 X
- LinkedIn:LinkedIn
- 直接:域名(例如 github.com)
5. 向用户确认
回复内容必须为:
💾 {N} 个资源已保存 · {来源标签}
{第一个资源的标题,截断至60字符}
如果无法提取任何内容:⚠️ 此链接中未找到资源。
示例
| 用户输入 | 来源类型 | 结果 |
|---|
| https://x.com/karpathy/status/123456 | Twitter/X | 提取推文文本 + 链接URL,总结每个资源,追加到 resources.md |
| https://linkedin.com/posts/someone-123 |
LinkedIn | 获取页面,总结,追加到 resources.md |
| 保存这个:https://github.com/anthropics/claude-code | 直接URL | 获取标题 + 总结,追加到 resources.md |
| https://x.com/elonmusk/status/789 保存这个 | Twitter/X | 提取推文 + 链接资源,总结,追加到 resources.md |