mcpField
R
rss-reader

rss-reader

github.com/winsorllc生产力072 次安装35 周前更新
代码仓库

关于 rss-reader

rss-reader 是用于获取和解析 RSS 与 Atom 订阅源的技能。它提供命令行工具和 Python 示例,可提取条目标题、日期、描述及链接。

主要功能

  1. 01获取 RSS 和 Atom 订阅源
  2. 02提取条目标题和链接
  3. 03列出近期条目及日期
  4. 04使用命令行工具或 Python 解析

适用场景

  1. 01查看博客的最新文章
  2. 02监控新闻来源的更新
  3. 03汇集多个订阅源的文章

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/winsorllc/upgraded-carnival --skill rss-reader

安装后在 Claude Code 中输入/rss-reader确认已加载。

详细介绍

RSS 阅读器技能

读取并解析 RSS/Atom 订阅源。

适用场景

  • 获取订阅源的最新文章
  • 订阅新闻来源
  • 监控博客更新
  • 聚合多个订阅源

订阅源信息

获取订阅源详情
# Get feed info
curl -s "https://example.com/feed.xml" | head -20

# Check if RSS or Atom
curl -s "https://example.com/feed.xml" | head -1

解析订阅源

使用 xmlstarlet
# Install if needed
# apt install xmlstarlet

# List all items
curl -s "feed.xml" | xmlstarlet sel -t -m "//item" -v "title" -n

# Get latest 5 titles
curl -s "feed.xml" | xmlstarlet sel -t -m "//item[position() <= 5]" -v "title" -n
使用 xmllint
# Parse with xmllint
curl -s "feed.xml" | xmllint --format - 2>/dev/null | head -50
使用 Python
# Simple feed parser
python3 -c "
import xml.etree.ElementTree as ET
import urllib.request

url = 'https://example.com/feed.xml'
data = urllib.request.urlopen(url).read()
root = ET# Find channel.fromstring(data)


for item in root.findall('.//item'):
    title = item.find('title')
    if title is not None:
        print(title.text)
"
使用 yq(如果可用)
# Convert RSS to YAML
curl -s "feed.xml" | yq -x '.rss.channel.item[]'

常用命令

列出订阅源条目
# Get all item titles
curl -s "feed.xml" | grep -o '<title>[^<]*</title>' | sed 's/<title>//;s/<\/title>//'

# With descriptions
curl -s "feed.xml" | grep -o '<title>[^<]*</title>\|<description>[^<]*</description>'
获取最新的 N 条目
# Latest 10 items with dates
curl -s "feed.xml" | grep -o '<item>.*</item>' | head -10 | \
  while read item; do
    echo "$item" | grep -o '<title>[^<]*</title>'
    echo "$item" | grep -o '<pubDate>[^<]*</pubDate>'
    echo "---"
  done
提取链接
# Get all article links
curl -s "feed.xml" | grep -o '<link>[^<]*</link>' | sed 's/<link>//;s/<\/link>//'

示例

Hacker News RSS
curl -s "https://news.ycombinator.com/rss" | \
  grep -o '<title>[^<]*</title>' | sed 's/<title>//;s/<\/title>//' | head -20
TechCrunch
curl -s "https://techcrunch.com/feed/" | \
  grep -o '<title>[^<]*</title>' | head -15
GitHub Trending
# GitHub doesn't have RSS, but you can use GitHub's API
curl -s "https://api.github.com/repos?sort=updated&per_page=10" | \
  jq '.[].full_name'

订阅源 URL

常见的 RSS 订阅源格式:

  • WordPress:/feed/ 或 /feed/rss/
  • Medium:/{username}/feed
  • YouTube:https://www.youtube.com/feeds/videos.xml?channel_id={id}
  • Twitter:使用 Nitter 或 RSSHub

注意事项

  • RSS 订阅源的元素名称可能各不相同(item 或 entry)
  • Atom 订阅源使用 <entry>,而非 <item>
  • 某些订阅源需要 user-agent 标头
  • 考虑缓存订阅源,以避免请求过于频繁

评论

支持 Markdown