sports-news
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSports News
体育新闻工具
Setup
安装配置
Before first use, check if the CLI is available:
bash
which sports-skills || pip install sports-skillsIf fails with a Python version error, the package requires Python 3.10+. Find a compatible Python:
pip installbash
python3 --version # check version首次使用前,检查CLI是否可用:
bash
which sports-skills || pip install sports-skills若因Python版本报错,说明该包要求Python 3.10及以上版本。请找到兼容的Python版本:
pip installbash
python3 --version # 检查版本If < 3.10, try: python3.12 -m pip install sports-skills
若版本低于3.10,尝试:python3.12 -m pip install sports-skills
On macOS with Homebrew: /opt/homebrew/bin/python3.12 -m pip install sports-skills
在使用Homebrew的macOS系统上:/opt/homebrew/bin/python3.12 -m pip install sports-skills
No API keys required.无需API密钥。Quick Start
快速开始
Prefer the CLI — it avoids Python import path issues:
bash
sports-skills news fetch_items --google_news --query="Arsenal transfer" --limit=5
sports-skills news fetch_feed --url="https://feeds.bbci.co.uk/sport/football/rss.xml"Python SDK (alternative):
python
from sports_skills import news
articles = news.fetch_items(google_news=True, query="Arsenal transfer news", limit=10)
feed = news.fetch_feed(url="https://feeds.bbci.co.uk/sport/football/rss.xml")推荐使用CLI——可避免Python导入路径问题:
bash
sports-skills news fetch_items --google_news --query="Arsenal transfer" --limit=5
sports-skills news fetch_feed --url="https://feeds.bbci.co.uk/sport/football/rss.xml"Python SDK(替代方案):
python
from sports_skills import news
articles = news.fetch_items(google_news=True, query="Arsenal transfer news", limit=10)
feed = news.fetch_feed(url="https://feeds.bbci.co.uk/sport/football/rss.xml")Commands
命令说明
fetch_feed
fetch_feed
Fetch and parse a full RSS/Atom feed.
- (bool, optional): Use Google News RSS. Default: false
google_news - (str): Search query (required if google_news=true)
query - (str): RSS feed URL (required if google_news=false)
url - (str, optional): Language code. Default: "en-US"
language - (str, optional): Country code. Default: "US"
country - (str, optional): Filter articles after date (YYYY-MM-DD)
after - (str, optional): Filter articles before date (YYYY-MM-DD)
before - (bool, optional): Sort newest first. Default: false
sort_by_date
获取并解析完整的RSS/Atom订阅源。
- (布尔值,可选):是否使用Google News的RSS源。默认值:false
google_news - (字符串):搜索关键词(当google_news=true时为必填项)
query - (字符串):RSS订阅源地址(当google_news=false时为必填项)
url - (字符串,可选):语言代码。默认值:"en-US"
language - (字符串,可选):国家代码。默认值:"US"
country - (字符串,可选):筛选指定日期之后的文章(格式:YYYY-MM-DD)
after - (字符串,可选):筛选指定日期之前的文章(格式:YYYY-MM-DD)
before - (布尔值,可选):是否按日期从新到旧排序。默认值:false
sort_by_date
fetch_items
fetch_items
Fetch items from a feed, optionally limited by count.
- Same params as , plus:
fetch_feed - (int, optional): Max number of items to return
limit
从订阅源获取文章,可选择限制返回数量。
- 包含的所有参数,新增:
fetch_feed - (整数,可选):返回文章的最大数量
limit
Useful RSS Feeds
实用RSS订阅源
| Source | URL |
|---|---|
| BBC Sport Football | |
| ESPN FC | |
| The Athletic | |
| Sky Sports Football | |
| 来源 | 地址 |
|---|---|
| BBC Sport Football | |
| ESPN FC | |
| The Athletic | |
| Sky Sports Football | |
Google News Queries
Google News 查询示例
Use with to search Google News:
google_news=Truequery- — Arsenal transfer news
"Arsenal transfer news" - — latest PL results
"Premier League results" - — CL draw coverage
"Champions League draw" - — World Cup news
"World Cup 2026"
设置并传入即可搜索Google News:
google_news=Truequery- — 阿森纳转会新闻
"Arsenal transfer news" - — 英超最新赛果
"Premier League results" - — 欧冠抽签报道
"Champions League draw" - — 2026世界杯新闻
"World Cup 2026"
Examples
使用示例
User: "What's the latest Arsenal transfer news?"
- Call
fetch_items(google_news=True, query="Arsenal transfer news", limit=10) - Present headlines with source, date, and links
User: "Show me BBC Sport football headlines"
- Call
fetch_feed(url="https://feeds.bbci.co.uk/sport/football/rss.xml") - Present feed title, last updated, and recent entries
User: "Any Champions League news from this week?"
- Call
fetch_items(google_news=True, query="Champions League", after="2026-02-09", sort_by_date=True, limit=10) - Present articles filtered to the last 7 days, sorted newest first
用户:“阿森纳的最新转会新闻是什么?”
- 调用
fetch_items(google_news=True, query="Arsenal transfer news", limit=10) - 展示包含来源、日期和链接的新闻头条
用户:“给我展示BBC Sport的足球头条”
- 调用
fetch_feed(url="https://feeds.bbci.co.uk/sport/football/rss.xml") - 展示订阅源标题、最后更新时间及近期文章
用户:“这周有欧冠相关新闻吗?”
- 调用
fetch_items(google_news=True, query="Champions League", after="2026-02-09", sort_by_date=True, limit=10) - 展示近7天内的文章,并按从新到旧排序
Troubleshooting
故障排除
- command not found: Package not installed. Run
sports-skills. If pip fails with a Python version error, you need Python 3.10+ — see Setup section.pip install sports-skills - : Same as above — install the package. Prefer the CLI over Python imports to avoid path issues.
ModuleNotFoundError: No module named 'sports_skills' - No results from Google News: Ensure is set AND
google_news=Trueis provided. Withoutquery, Google News has nothing to search.query - RSS feed returns error: Some feeds may block automated requests or be temporarily down. Use Google News as a fallback.
- Old articles appearing: Use the parameter (YYYY-MM-DD) to filter to recent articles. Combine with
after.sort_by_date=True - Non-English results: Set (e.g., "pt-BR") and
language(e.g., "BR") for localized Google News results.country
- 命令未找到:未安装该包。请运行
sports-skills。若pip因Python版本报错,说明你需要Python 3.10及以上版本——请查看安装配置部分。pip install sports-skills - :同上,请安装该包。推荐使用CLI而非Python导入,以避免路径问题。
ModuleNotFoundError: No module named 'sports_skills' - Google News无结果返回:确保已设置且提供了
google_news=True参数。没有query的话,Google News无法进行搜索。query - RSS订阅源返回错误:部分订阅源可能会阻止自动化请求或临时下线。可使用Google News作为替代方案。
- 出现旧文章:使用参数(格式:YYYY-MM-DD)筛选近期文章。可结合
after使用。sort_by_date=True - 返回非英文结果:设置(例如"pt-BR")和
language(例如"BR")参数,以获取本地化的Google News结果。country