Token导航 LogoToken导航TokenDH.com
X Article Exporter logo
文档知识未说明官方级别未说明来源级核验

X Article Exporter

MCP Server

将X(Twitter)文章导出为高质量的PDF,支持翻译和暗黑模式。

工具数

1

提示词数

0

GitHub Stars

2

资源数

0
GoClaude命令行工具Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

annismckenzie

提供方

annismckenzie

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

X文章出口商

出口 X(推特)文章 作为高质量的PDF文件,具有可选的翻译和暗模式。

Go License

截图

Light mode Dark mode

特性

  • 命令行界面 --从终端将任何X文章URL导出为PDF
  • 翻译 --通过本地翻译文章 奥拉玛 + 翻译法 (55种以上语言)
  • 深色模式 --黑色背景渲染与X的深色主题相匹配
  • HTTP API --具有异步作业处理、速率限制和承载身份验证的自托管服务器
  • MCP服务器 --用作 克劳德代码 从对话中导出文章的工具
  • 质量验证 --通过以下方式进行结构PDF检查 pdfcpu +文本提取验证

先决条件

安装

go install github.com/annismckenzie/x-article-exporter@latest

或者从源代码构建:

git clone https://github.com/annismckenzie/x-article-exporter.git
cd x-article-exporter
go build -o x-article-exporter .

快速开始

1.获取身份验证Cookie

打开 x.com 在浏览器中,然后:

  1. 打开DevTools(F12或Cmd+选项+I)
  2. 首选 应用 > Cookie > https://x.com
  3. 复制以下值 auth_tokenct0

2.创建配置文件

保存到 ~/.config/x-article-exporter/config.yaml:

auth_token: "your-auth-token"
ct0: "your-ct0"

3.出口物品

x-article-exporter https://x.com/user/article/1234567890

这将在以文章标题命名的当前目录中创建一个PDF。

配置

所有设置都进入 ~/.config/x-article-exporter/config.yaml.CLI标志覆盖配置值。

# Required: X authentication cookies (get from browser dev tools)
auth_token: "your-auth-token"
ct0: "your-ct0"

# Optional: Ollama model for translation (default: translategemma:12b)
# ollama_model: "translategemma:12b"

# Optional: Render PDFs in dark mode
# dark_mode: true

# Server mode configuration (used with --serve)
server:
  port: 8080
  host: "127.0.0.1"
  job_ttl_minutes: 60
  default_rate_limit_per_hour: 20
  max_concurrent_jobs: 4
  api_keys:
    - key: "your-api-key-here"
      name: "default"
      # rate_limit_per_hour: 20  # omit to use default_rate_limit_per_hour

config.example.yaml 以获取完整参考。

用法

命令行界面

x-article-exporter [flags] 
标志描述
-auth-token 十、 auth_token cookie(覆盖配置)
-ct0 十、 ct0 cookie(覆盖配置)
-translate翻译成目标语言(例如。 de, fr, ja)
-dark在暗模式下渲染PDF
-output输出PDF路径(默认: ./{title}.pdf)
-query-idGraphQL查询ID覆盖(如果省略,则自动解析)
-ollama-modelOllama翻译模型(默认值: translategemma:12b)

示例:

# Basic export
x-article-exporter https://x.com/elonmusk/article/1234567890

# Translate to German
x-article-exporter -translate de https://x.com/elonmusk/article/1234567890

# Dark mode with custom output path
x-article-exporter -dark -output ~/Documents/article.pdf https://x.com/elonmusk/article/1234567890

HTTP API

启动服务器:

x-article-exporter --serve

导出工作流程:

# Submit an article for export
curl -X POST -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://x.com/user/article/123"}' \
  http://localhost:8080/export

# Check job status
curl -H "Authorization: Bearer your-api-key" \
  http://localhost:8080/export/{id}

# Download the PDF
curl -H "Authorization: Bearer your-api-key" \
  http://localhost:8080/export/{id}/pdf -o article.pdf

API.md 用于请求/响应模式的完整端点引用。

MCP服务器(克劳德代码)

注册成为Claude Code工具:

claude mcp add x-article-exporter /path/to/x-article-exporter -- --mcp

然后问克劳德: *“将此文章导出为PDF:https://x.com/user/article/123"*

docs/mcp-setup.md 了解完整的设置指南、可用工具和故障排除。

运作原理

  1. 提取 -通过X的GraphQL API获取文章(TweetResultByRestId),解析Draft.js内容模型
  2. 翻译 *(可选)* --将文本块批量发送到运行translategemma的本地Ollama实例
  3. 渲染 --从文章模型生成Typst源代码,编译为嵌入字体和图像的PDF
  4. 验证 --使用pdfcpu运行结构检查并验证文本提取

贡献

# Run tests
make test

# Run end-to-end test (requires auth config)
make test-article

# Visual preview (generates PDF + PNGs)
make preview
make preview-dark

建筑和设计文件在 shaping/.

许可证

麻省理工学院

目录标签

目录标签

GoClaude命令行工具PDF导出本地部署文章翻译暗黑模式X(Twitter)工具CLI工具

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP