rss-reader
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRSS Reader Skill
RSS 阅读器技能
Read and parse RSS/Atom feeds.
读取并解析RSS/Atom订阅源。
When to Use
适用场景
- Get latest articles from a feed
- Subscribe to news sources
- Monitor blog updates
- Aggregate multiple feeds
- 获取订阅源的最新文章
- 订阅新闻来源
- 监控博客更新
- 聚合多个订阅源
Feed Information
订阅源信息
Get Feed Details
获取订阅源详情
bash
undefinedbash
undefinedGet feed info
获取订阅源信息
curl -s "https://example.com/feed.xml" | head -20
curl -s "https://example.com/feed.xml" | head -20
Check if RSS or Atom
检查是RSS还是Atom
curl -s "https://example.com/feed.xml" | head -1
undefinedcurl -s "https://example.com/feed.xml" | head -1
undefinedParse Feeds
解析订阅源
Using xmlstarlet
使用xmlstarlet
bash
undefinedbash
undefinedInstall if needed
如有需要先安装
apt install xmlstarlet
apt install xmlstarlet
List all items
列出所有条目
curl -s "feed.xml" | xmlstarlet sel -t -m "//item" -v "title" -n
curl -s "feed.xml" | xmlstarlet sel -t -m "//item" -v "title" -n
Get latest 5 titles
获取最新5条标题
curl -s "feed.xml" | xmlstarlet sel -t -m "//item[position() <= 5]" -v "title" -n
undefinedcurl -s "feed.xml" | xmlstarlet sel -t -m "//item[position() <= 5]" -v "title" -n
undefinedUsing xmllint
使用xmllint
bash
undefinedbash
undefinedParse with xmllint
使用xmllint解析
curl -s "feed.xml" | xmllint --format - 2>/dev/null | head -50
undefinedcurl -s "feed.xml" | xmllint --format - 2>/dev/null | head -50
undefinedUsing Python
使用Python
bash
undefinedbash
undefinedSimple 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)
"
undefinedpython3 -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)
"
undefinedUsing yq (if available)
使用yq(若已安装)
bash
undefinedbash
undefinedConvert RSS to YAML
将RSS转换为YAML
curl -s "feed.xml" | yq -x '.rss.channel.item[]'
undefinedcurl -s "feed.xml" | yq -x '.rss.channel.item[]'
undefinedCommon Commands
常用命令
List Feed Items
列出订阅源条目
bash
undefinedbash
undefinedGet all item titles
获取所有条目标题
curl -s "feed.xml" | grep -o '<title>[^<]*</title>' | sed 's/<title>//;s/</title>//'
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>'
undefinedcurl -s "feed.xml" | grep -o '<title>[^<]</title>|<description>[^<]</description>'
undefinedGet Latest N Items
获取最新N条条目
bash
undefinedbash
undefinedLatest 10 items with dates
包含日期的最新10条条目
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
while read item; do echo "$item" | grep -o '<title>[^<]</title>' echo "$item" | grep -o '<pubDate>[^<]*</pubDate>' echo "---" done
undefinedcurl -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
while read item; do echo "$item" | grep -o '<title>[^<]</title>' echo "$item" | grep -o '<pubDate>[^<]*</pubDate>' echo "---" done
undefinedExtract Links
提取链接
bash
undefinedbash
undefinedGet all article links
获取所有文章链接
curl -s "feed.xml" | grep -o '<link>[^<]*</link>' | sed 's/<link>//;s/</link>//'
undefinedcurl -s "feed.xml" | grep -o '<link>[^<]*</link>' | sed 's/<link>//;s/</link>//'
undefinedExamples
示例
Hacker News RSS
Hacker News RSS
bash
curl -s "https://news.ycombinator.com/rss" | \
grep -o '<title>[^<]*</title>' | sed 's/<title>//;s/<\/title>//' | head -20bash
curl -s "https://news.ycombinator.com/rss" | \
grep -o '<title>[^<]*</title>' | sed 's/<title>//;s/<\/title>//' | head -20TechCrunch
TechCrunch
bash
curl -s "https://techcrunch.com/feed/" | \
grep -o '<title>[^<]*</title>' | head -15bash
curl -s "https://techcrunch.com/feed/" | \
grep -o '<title>[^<]*</title>' | head -15GitHub Trending
GitHub Trending
bash
undefinedbash
undefinedGitHub doesn't have RSS, but you can use GitHub's API
GitHub 没有原生RSS,但可以使用GitHub API
curl -s "https://api.github.com/repos?sort=updated&per_page=10" |
jq '.[].full_name'
jq '.[].full_name'
undefinedcurl -s "https://api.github.com/repos?sort=updated&per_page=10" |
jq '.[].full_name'
jq '.[].full_name'
undefinedFeed URLs
订阅源URL格式
Common RSS feed patterns:
- WordPress: or
/feed//feed/rss/ - Medium:
/{username}/feed - YouTube:
https://www.youtube.com/feeds/videos.xml?channel_id={id} - Twitter: Use Nitter or RSSHub
常见RSS订阅源格式:
- WordPress: 或
/feed//feed/rss/ - Medium:
/{username}/feed - YouTube:
https://www.youtube.com/feeds/videos.xml?channel_id={id} - Twitter: 使用Nitter或RSSHub
Notes
注意事项
- RSS feeds may have different element names (item vs entry)
- Atom feeds use instead of
<entry><item> - Some feeds require user-agent headers
- Consider caching feeds to avoid excessive requests
- RSS订阅源的元素名称可能不同(item与entry)
- Atom订阅源使用而非
<entry><item> - 部分订阅源需要user-agent请求头
- 建议缓存订阅源以避免过度请求