Skip to content
cccskills
FreePublished on GitHub

news-extractor

新闻站点内容提取。支持微信公众号、今日头条、网易新闻、搜狐新闻、腾讯新闻。当用户需要提取新闻内容、抓取公众号文章、爬取新闻、或获取新闻JSON/Markdown时激活。

The English summary is being prepared. Showing the original description.

See how to install

Files included (15)

  • SKILL.md4.4 KB
  • pyproject.toml390 B
  • references/platform-patterns.md3.6 KB
  • scripts/crawlers/__init__.py378 B
  • scripts/crawlers/base.py5.0 KB
  • scripts/crawlers/fetchers.py2.7 KB
  • scripts/crawlers/netease.py4.2 KB
  • scripts/crawlers/sohu.py5.6 KB
  • scripts/crawlers/tencent.py4.4 KB
  • scripts/crawlers/toutiao.py4.8 KB
  • scripts/crawlers/wechat.py14.6 KB
  • scripts/detector.py1.3 KB
  • scripts/extract_news.py6.3 KB
  • scripts/formatter.py1.9 KB
  • scripts/models.py3.1 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

News Extractor Skill

从主流新闻平台提取文章内容,输出 JSON 和 Markdown 格式。

支持平台

平台IDURL 示例
微信公众号wechathttps://mp.weixin.qq.com/s/xxxxx
今日头条toutiaohttps://www.toutiao.com/article/123456/
网易新闻neteasehttps://www.163.com/news/article/ABC123.html
搜狐新闻sohuhttps://www.sohu.com/a/123456_789
腾讯新闻tencenthttps://news.qq.com/rain/a/20251016A07W8J00

依赖安装

本 skill 使用 uv 管理依赖。首次使用前需要安装:

cd ~/.claude/skills/news-extractor
uv sync

重要: 所有脚本必须使用 uv run 执行,不要直接用 python 运行。uv run 会自动使用项目虚拟环境中的依赖。

依赖列表

包名用途
pydantic数据模型验证
requestsHTTP 请求
curl_cffi浏览器模拟抓取
tenacity重试机制
parselHTML/XPath 解析
demjson3非标准 JSON 解析

使用方式

基本用法

# 提取新闻,自动检测平台,输出 JSON + Markdown
uv run .claude/skills/news-extractor/scripts/extract_news.py "URL"

# 指定输出目录
uv run .claude/skills/news-extractor/scripts/extract_news.py "URL" --output ./output

# 仅输出 JSON
uv run .claude/skills/news-extractor/scripts/extract_news.py "URL" --format json

# 仅输出 Markdown
uv run .claude/skills/news-extractor/scripts/extract_news.py "URL" --format markdown

# 列出支持的平台
uv run .claude/skills/news-extractor/scripts/extract_news.py --list-platforms

输出文件

脚本默认输出两种格式到指定目录(默认 ./output):

  • {news_id}.json - 结构化 JSON 数据
  • {news_id}.md - Markdown 格式文章

工作流程

  1. 接收 URL - 用户提供新闻链接
  2. 平台检测 - 自动识别平台类型
  3. 内容提取 - 调用对应爬虫获取并解析内容
  4. 格式转换 - 生成 JSON 和 Markdown
  5. 输出文件 - 保存到指定目录

输出格式

JSON 结构

{
  "title": "文章标题",
  "news_url": "原始链接",
  "news_id": "文章ID",
  "meta_info": {
    "author_name": "作者/来源",
    "author_url": "",
    "publish_time": "2024-01-01 12:00"
  },
  "contents": [
    {"type": "text", "content": "段落文本", "desc": ""},
    {"type": "image", "content": "https://...", "desc": ""},
    {"type": "video", "content": "https://...", "desc": ""}
  ],
  "texts": ["段落1", "段落2"],
  "images": ["图片URL1", "图片URL2"],
  "videos": []
}

Markdown 结构

# 文章标题

## 文章信息
**作者**: xxx
**发布时间**: 2024-01-01 12:00
**原文链接**: [链接](URL)

---

## 正文内容

段落内容...

![图片](URL)

---

## 媒体资源
### 图片 (N)
1. URL1
2. URL2

使用示例

提取微信公众号文章

uv run .claude/skills/news-extractor/scripts/extract_news.py \
  "https://mp.weixin.qq.com/s/ebMzDPu2zMT_mRgYgtL6eQ"

输出:

[INFO] Platform detected: wechat (微信公众号)
[INFO] Extracting content...
[INFO] Title: 文章标题
[INFO] Author: 公众号名称
[INFO] Text paragraphs: 15
[INFO] Images: 3
[SUCCESS] Saved: ./output/ebMzDPu2zMT_mRgYgtL6eQ.json
[SUCCESS] Saved: ./output/ebMzDPu2zMT_mRgYgtL6eQ.md

提取今日头条文章

uv run .claude/skills/news-extractor/scripts/extract_news.py \
  "https://www.toutiao.com/article/7434425099895210546/"

错误处理

错误类型说明解决方案
无法识别该平台URL 不匹配任何支持的平台检查 URL 是否正确
平台不支持非支持的站点本 Skill 仅支持列出的新闻站点
提取失败网络错误或页面结构变化重试或检查 URL 有效性

注意事项

  • 仅用于教育和研究目的
  • 不要进行大规模爬取
  • 尊重目标网站的 robots.txt 和服务条款
  • 微信公众号可能需要有效的 Cookie(当前默认配置通常可用)

参考

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Agent Teams 智能编排决策引擎。自动分析任务复杂度,判断使用 Subagent 还是 Agent Teams。 触发场景: (1) 任务涉及多角度并行分析(如代码审查、竞争假说调试) (2) 需要成员之间互相通信、质疑、协作 (3) 跨层开发(前端/后端/测试各自负责) (4) 用户明确要求"创建团队"、"用 agent teams" (5) 任务描述包含"并行"、"同时"、"多人"、"协作"等关键词 (6) 使用 /team 命令

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

为 B站视频生成章节列表。 触发场景: (1) 需要为视频创建 B站章节 (2) 用户说"转成B站格式"、"生成章节"、"生成B站章节" (3) 需要从字幕生成视频分段 (4) 处理视频进度条分段标记

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

Manage Feishu channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Feishu channel.

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

Set up the Feishu channel — save the bot credentials and check connection status. Use when the user pastes Feishu app credentials, asks to configure Feishu, or wants to check channel status.

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

LangChain 1.0 使用指南。提供 Agent、Tool、Memory、Middleware 等核心概念的快速参考。当用户需要创建 AI Agent、集成 LangChain、或解决 LangChain 相关问题时激活。

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

Generate interactive presentation slides using React + Tailwind. Triggers on keywords like "slides", "presentation", "PPT", "demo", "benchmark".

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

See all skills by NanmiCoder

Report a problem with this skill