News Extractor logo

News Extractor

Community
NanmiCoder
news-extractor

新闻站点内容提取。支持 12 个平台:微信公众号、今日头条、网易新闻、搜狐新闻、腾讯新闻、BBC News、CNN News、Twitter/X、Lenny's Newsletter、Naver Blog、Detik News、Quora。当用户需要提取新闻内容、抓取公众号文章、爬取新闻、或获取新闻JSON/Markdown时激活。

Overview

PublisherNanmiCoder
RepositoryNewsCrawler
Skill namenews-extractor
Stars
624
Forks
110
Bundled files
24
LicenseGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 24 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by NanmiCoder on GitHub. Read the source before you install it.

Installation

Install the News Extractor AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/NanmiCoder/NewsCrawler/tree/main/.claude/skills/news-extractor
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/NanmiCoder/NewsCrawler.git /tmp/NewsCrawler
mkdir -p .claude/skills
cp -r /tmp/NewsCrawler/.claude/skills/news-extractor .claude/skills/news-extractor
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable News Extractor in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads News Extractor on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so News Extractor is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

News Extractor Skill

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

标准兼容、独立可迁移:本目录遵循 Agent Skills 规范,包含完整的 SKILL.md、脚本与依赖,不依赖 NewsCrawler 的其他模块。通过兼容的 Skills 安装器安装后,运行一次 uv sync 即可使用。

运行环境需要 Python 3.9+、uv 和目标站点的网络访问。

支持平台 (12)

中文平台

平台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

国际平台

平台IDURL 示例
BBC Newsbbchttps://www.bbc.com/news/articles/c797qlx93j0o
CNN Newscnnhttps://edition.cnn.com/2025/10/27/uk/article-slug
Twitter/Xtwitterhttps://x.com/user/status/123456789
Lenny's Newsletterlennyhttps://www.lennysnewsletter.com/p/article-slug
Naver Blognaverhttps://blog.naver.com/username/123456
Detik Newsdetikhttps://news.detik.com/internasional/d-123456/slug
Quoraquorahttps://www.quora.com/question/answers/123456

依赖安装

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

bash
cd <Agent Skills 目录>/news-extractor
uv sync

重要: 所有脚本必须使用 uv run 执行,不要直接用 python 运行。

依赖列表

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

使用方式

基本用法

bash
# 以下命令均在 news-extractor Skill 目录内执行

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

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

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

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

# Twitter 受保护推文 (需要 Cookie)
uv run scripts/extract_news.py "URL" --cookie "auth_token=xxx; ct0=yyy"

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

输出文件

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

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

工作流程

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

输出格式

JSON 结构

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 结构

markdown
# 文章标题

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

---

## 正文内容

段落内容...

![图片](URL)

---

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

使用示例

提取微信公众号文章

bash
uv run scripts/extract_news.py \
  "https://mp.weixin.qq.com/s/ebMzDPu2zMT_mRgYgtL6eQ"

提取 BBC 新闻

bash
uv run scripts/extract_news.py \
  "https://www.bbc.com/news/articles/c797qlx93j0o"

提取 Twitter 推文

bash
# 公开推文 (无需认证)
uv run scripts/extract_news.py \
  "https://x.com/BarackObama/status/896523232098078720"

# 受保护推文 (需要 Cookie)
uv run scripts/extract_news.py \
  "https://x.com/user/status/123456" --cookie "auth_token=xxx; ct0=yyy"

错误处理

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

注意事项

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

目录结构

news-extractor/
├── SKILL.md                      # [必需] Skill 定义文件
├── pyproject.toml                # 依赖管理
├── references/
│   └── platform-patterns.md      # 平台 URL 模式说明
└── scripts/
    ├── extract_news.py           # CLI 入口脚本
    ├── models.py                 # 数据模型
    ├── detector.py               # 平台检测
    ├── formatter.py              # Markdown 格式化
    └── crawlers/                 # 爬虫模块
        ├── __init__.py
        ├── base.py               # BaseNewsCrawler 基类
        ├── fetchers.py           # HTTP 获取策略
        ├── wechat.py             # 微信公众号
        ├── toutiao.py            # 今日头条
        ├── netease.py            # 网易新闻
        ├── sohu.py               # 搜狐新闻
        ├── tencent.py            # 腾讯新闻
        ├── bbc.py                # BBC News
        ├── cnn.py                # CNN News
        ├── twitter.py            # Twitter/X
        ├── twitter_client.py     # Twitter API 客户端
        ├── twitter_types.py      # Twitter 数据类型
        ├── lenny.py              # Lenny's Newsletter
        ├── naver.py              # Naver Blog
        ├── detik.py              # Detik News
        └── quora.py              # Quora

参考

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the News Extractor AI skill do?

新闻站点内容提取。支持 12 个平台:微信公众号、今日头条、网易新闻、搜狐新闻、腾讯新闻、BBC News、CNN News、Twitter/X、Lenny's Newsletter、Naver Blog、Detik News、Quora。当用户需要提取新闻内容、抓取公众号文章、爬取新闻、或获取新闻JSON/Markdown时激活。

Why use News Extractor on TypingMind?

Because you install it once and use it with any model. News Extractor is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install News Extractor in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/NanmiCoder/NewsCrawler/tree/main/.claude/skills/news-extractor. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use News Extractor?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with News Extractor?

As many as you like. As long as a model supports skills, you can use News Extractor with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the News Extractor AI skill free?

Yes. It is published on GitHub by NanmiCoder under the GPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇