Skip to content

jianshuo/claude-skills / wjs-publishing-books-to-x

wjs-publishing-books-to-x

Unverified

Use when 王建硕 wants to publish his VoiceDrop books (voicedrop.cn/books) to X/Twitter as threads — 列出他写的书、挑没发过的、整本拆成推文串发出。Triggers — "把书发到 X", "发书的 thread", "publish my book to X", "书架的书发推", "/wjs-publishing-books-to-x".

FileKindSize
SKILL.mdskill md6.3 KB
com.jianshuo.wjs-publishing-books-to-x.plist.templateother1.0 KB
daily.shexecutablescript6.8 KB
scripts/fetch-book.pyexecutablescript2.1 KB
scripts/pick-next-book.shexecutablescript1.3 KB
state/.gitignoreother22 B

scripts/fetch-book.py

View on GitHub
#!/usr/bin/env python3
"""fetch-book.py <slug> <outfile> — 把一本书的素材抓成一个纯文本文件,给 claude -p 起草 thread 用。

素材 = _src/book.json(书名/副题/简介/目录+每章梗概)+ 序章 + 前两章正文(各截 4000 字)。
公开内容,免登录。"""
import json
import re
import sys
import urllib.request
from html import unescape

BASE = "https://jianshuo.dev/voicedrop/books"


UA = {"User-Agent": "Mozilla/5.0 wjs-publishing-books-to-x"}  # 裸 urllib UA 会被 CF 403


def get(path):
    try:
        req = urllib.request.Request(f"{BASE}/{path}", headers=UA)
        with urllib.request.urlopen(req, timeout=30) as r:
            return r.read().decode("utf-8", "replace")
    except Exception:
        return ""


def text(html):
    html = re.sub(r"<script[\s\S]*?</script>|<style[\s\S]*?</style>", "", html)
    html = re.sub(r'<div id="abw"[\s\S]*?</div>', "", html)  # 「听本章」播放器
    html = re.sub(r"</(p|div|h[1-6]|li|blockquote)>", "\n", html, flags=re.I)
    html = re.sub(r"<[^>]+>", "", html)
    return re.sub(r"\n{3,}", "\n\n", unescape(html)).strip()


slug, out = sys.argv[1], sys.argv[2]
parts, nums = [], []
src = get(f"{slug}/_src/book.json")
if src:
    try:
        j = json.loads(src)
        parts.append(f"书名: {j.get('title', '')}\n副题: {j.get('subtitle', '')}\n简介: {j.get('tagline', '')}")
        toc = [f"{i:02d}. {c.get('title', '')} — {c.get('brief') or c.get('synopsis') or ''}"
               for i, c in enumerate(j.get("chapters", []), 1)]
        parts.append("目录与梗概:\n" + "\n".join(toc))
        nums = [f"{i:02d}" for i in range(1, len(j.get("chapters", [])) + 1)]
    except Exception:
        pass
intro = text(get(f"{slug}/intro.html"))
if intro:
    parts.append("=== 序章 ===\n" + intro[:4000])
for n in nums[:2]:
    t = text(get(f"{slug}/{n}.html"))
    if t:
        parts.append(f"=== 第{n}章正文 ===\n" + t[:4000])
if not parts:
    sys.exit(f"FATAL: no material for {slug}")
open(out, "w").write("\n\n".join(parts))
print(f"{out}: {sum(len(p) for p in parts)} chars, {len(parts)} sections")
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
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: 196kUpdated Claude CodeCodexVerifiedInstall