Rechercher

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 installations selon la source☆ 0 Étoiles du dépôt

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

SkillHub CLI

skillhub install alphafactor/x-publisher

Examinez la source et la compatibilité, puis suivez les étapes d’installation.

Donnez le lien à votre agent et demandez-lui d’examiner instructions et dépendances avant d’expliquer les étapes.

Voir la source ↗Guides

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:...

Informations sur la source

Source
github
Repository
openclaw/skills
Path
skills/alphafactor/x-publisher
Version
—
Commit
f90510bb6422d04eb96f579150ffd9f30176bf43
Source de classification
rules
Statut
active
Visibilité
public

Ces informations proviennent de l’analyse indexée et peuvent être anciennes. Vérifiez les fichiers actuels.

Contenu extrait

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:...

Skills associés

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.