Search

PythonReactSEOPDF
OpenClaw

X-Publisher

Publish tweets to X (Twitter) using the official Tweepy library. Supports text-only tweets, tweets with images or videos, and returns detailed publish results including tweet ID and URL. Requires X API credentials (API Key, API Secret, Access Token, Access Token Secret).

alphafactor0 source installs☆ 0 Repository stars

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

SkillHub CLI

skillhub install alphafactor/x-publisher

Inspect the source and compatibility requirements, then follow its installation steps.

Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.

View source ↗Guides

Skill instructions

X (Twitter) 推文发布工具

使用官方 Tweepy 库发布推文,支持纯文本、图片、视频等多种媒体类型。

功能特性

  • 📝 纯文本推文 - 快速发布文字内容
  • 🖼️ 图片支持 - 支持 JPG、PNG、GIF、WebP 格式(最多4张)
  • 🎬 视频支持 - 支持 MP4、MOV、AVI、WebM 格式
  • 📊 返回结果 - 返回推文 ID、链接、发布时间等详细信息
  • ✅ 认证验证 - 支持验证 API 凭证是否有效

前提条件

1. 安装依赖
pip3 install tweepy --user
2. 获取 X API 凭证
  1. 访问 https://developer.twitter.com/en/portal/dashboard
  2. 创建项目并生成 API 密钥
  3. 获取以下凭证:
    • API Key
    • API Secret
    • Access Token
    • Access Token Secret
3. 配置环境变量
# 添加到 ~/.zshrc
export X_API_KEY="your-api-key"
export X_API_SECRET="your-api-secret"
export X_ACCESS_TOKEN="your-access-token"
export X_ACCESS_TOKEN_SECRET="your-access-token-secret"
export X_BEARER_TOKEN="your-bearer-token"  # 可选

然后执行:

source ~/.zshrc

使用方法

验证认证信息

首次使用前,建议先验证凭证:

python3 scripts/x_publisher.py verify

输出示例:

✅ 认证成功!
👤 用户名: @your_username
📛 显示名: Your Name
👥 粉丝: 1,234
📝 推文: 5,678
发布纯文本推文
python3 scripts/x_publisher.py tweet "Hello, X! This is my first tweet."
发布带图片的推文
# 单张图片
python3 scripts/x_publisher.py tweet "Check out this photo!" --media /path/to/image.jpg

# 多张图片(最多4张)
python3 scripts/x_publisher.py tweet "My photo collection:" \
  --media /path/to/photo1.jpg \
  --media /path/to/photo2.png \
  --media /path/to/photo3.gif
发布带视频的推文
python3 scripts/x_publisher.py tweet "Watch this video!" --media /path/to/video.mp4

输出结果

发布成功后会返回:

============================================================
✅ 推文发布成功!
============================================================
📝 推文 ID: 1234567890123456789
🔗 链接: https://twitter.com/user/status/1234567890123456789
⏰ 发布时间: 2024-02-03T15:...

Source information

Source
github
Repository
openclaw/skills
Path
skills/alphafactor/x-publisher
Version
—
Commit
f90510bb6422d04eb96f579150ffd9f30176bf43
Classification source
rules
Status
active
Visibility
public

These signals come from indexed source analysis and may lag behind changes. Check the current source files.

Extracted content

SKILL.md
# X (Twitter) 推文发布工具

使用官方 Tweepy 库发布推文,支持纯文本、图片、视频等多种媒体类型。

## 功能特性

- 📝 **纯文本推文** - 快速发布文字内容
- 🖼️ **图片支持** - 支持 JPG、PNG、GIF、WebP 格式(最多4张)
- 🎬 **视频支持** - 支持 MP4、MOV、AVI、WebM 格式
- 📊 **返回结果** - 返回推文 ID、链接、发布时间等详细信息
- ✅ **认证验证** - 支持验证 API 凭证是否有效

## 前提条件

### 1. 安装依赖

```bash
pip3 install tweepy --user
```

### 2. 获取 X API 凭证

1. 访问 https://developer.twitter.com/en/portal/dashboard
2. 创建项目并生成 API 密钥
3. 获取以下凭证:
   - API Key
   - API Secret
   - Access Token
   - Access Token Secret

### 3. 配置环境变量

```bash
# 添加到 ~/.zshrc
export X_API_KEY="your-api-key"
export X_API_SECRET="your-api-secret"
export X_ACCESS_TOKEN="your-access-token"
export X_ACCESS_TOKEN_SECRET="your-access-token-secret"
export X_BEARER_TOKEN="your-bearer-token"  # 可选
```

然后执行:
```bash
source ~/.zshrc
```

## 使用方法

### 验证认证信息

首次使用前,建议先验证凭证:

```bash
python3 scripts/x_publisher.py verify
```

输出示例:
```
✅ 认证成功!
👤 用户名: @your_username
📛 显示名: Your Name
👥 粉丝: 1,234
📝 推文: 5,678
```

### 发布纯文本推文

```bash
python3 scripts/x_publisher.py tweet "Hello, X! This is my first tweet."
```

### 发布带图片的推文

```bash
# 单张图片
python3 scripts/x_publisher.py tweet "Check out this photo!" --media /path/to/image.jpg

# 多张图片(最多4张)
python3 scripts/x_publisher.py tweet "My photo collection:" \
  --media /path/to/photo1.jpg \
  --media /path/to/photo2.png \
  --media /path/to/photo3.gif
```

### 发布带视频的推文

```bash
python3 scripts/x_publisher.py tweet "Watch this video!" --media /path/to/video.mp4
```

## 输出结果

发布成功后会返回:

```
============================================================
✅ 推文发布成功!
============================================================
📝 推文 ID: 1234567890123456789
🔗 链接: https://twitter.com/user/status/1234567890123456789
⏰ 发布时间: 2024-02-03T15:...

Related skills

OpenClaw

13-Day Sprint Method

galizki

Productivity system based on Maya calendar with 13 natural tones for project management and personal development

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.