sports-news

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sports News

体育新闻工具

Setup

安装配置

Before first use, check if the CLI is available:
bash
which sports-skills || pip install sports-skills
If
pip install
fails with a Python version error, the package requires Python 3.10+. Find a compatible Python:
bash
python3 --version  # check version
首次使用前,检查CLI是否可用:
bash
which sports-skills || pip install sports-skills
pip install
因Python版本报错,说明该包要求Python 3.10及以上版本。请找到兼容的Python版本:
bash
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.
  • google_news
    (bool, optional): Use Google News RSS. Default: false
  • query
    (str): Search query (required if google_news=true)
  • url
    (str): RSS feed URL (required if google_news=false)
  • language
    (str, optional): Language code. Default: "en-US"
  • country
    (str, optional): Country code. Default: "US"
  • after
    (str, optional): Filter articles after date (YYYY-MM-DD)
  • before
    (str, optional): Filter articles before date (YYYY-MM-DD)
  • sort_by_date
    (bool, optional): Sort newest first. Default: false
获取并解析完整的RSS/Atom订阅源。
  • google_news
    (布尔值,可选):是否使用Google News的RSS源。默认值:false
  • query
    (字符串):搜索关键词(当google_news=true时为必填项)
  • url
    (字符串):RSS订阅源地址(当google_news=false时为必填项)
  • language
    (字符串,可选):语言代码。默认值:"en-US"
  • country
    (字符串,可选):国家代码。默认值:"US"
  • after
    (字符串,可选):筛选指定日期之后的文章(格式:YYYY-MM-DD)
  • before
    (字符串,可选):筛选指定日期之前的文章(格式:YYYY-MM-DD)
  • sort_by_date
    (布尔值,可选):是否按日期从新到旧排序。默认值:false

fetch_items

fetch_items

Fetch items from a feed, optionally limited by count.
  • Same params as
    fetch_feed
    , plus:
  • limit
    (int, optional): Max number of items to return
从订阅源获取文章,可选择限制返回数量。
  • 包含
    fetch_feed
    的所有参数,新增:
  • limit
    (整数,可选):返回文章的最大数量

Useful RSS Feeds

实用RSS订阅源

SourceURL
BBC Sport Football
https://feeds.bbci.co.uk/sport/football/rss.xml
ESPN FC
https://www.espn.com/espn/rss/soccer/news
The Athletic
https://theathletic.com/rss/
Sky Sports Football
https://www.skysports.com/rss/12040
来源地址
BBC Sport Football
https://feeds.bbci.co.uk/sport/football/rss.xml
ESPN FC
https://www.espn.com/espn/rss/soccer/news
The Athletic
https://theathletic.com/rss/
Sky Sports Football
https://www.skysports.com/rss/12040

Google News Queries

Google News 查询示例

Use
google_news=True
with
query
to search Google News:
  • "Arsenal transfer news"
    — Arsenal transfer news
  • "Premier League results"
    — latest PL results
  • "Champions League draw"
    — CL draw coverage
  • "World Cup 2026"
    — World Cup news
设置
google_news=True
并传入
query
即可搜索Google News:
  • "Arsenal transfer news"
    — 阿森纳转会新闻
  • "Premier League results"
    — 英超最新赛果
  • "Champions League draw"
    — 欧冠抽签报道
  • "World Cup 2026"
    — 2026世界杯新闻

Examples

使用示例

User: "What's the latest Arsenal transfer news?"
  1. Call
    fetch_items(google_news=True, query="Arsenal transfer news", limit=10)
  2. Present headlines with source, date, and links
User: "Show me BBC Sport football headlines"
  1. Call
    fetch_feed(url="https://feeds.bbci.co.uk/sport/football/rss.xml")
  2. Present feed title, last updated, and recent entries
User: "Any Champions League news from this week?"
  1. Call
    fetch_items(google_news=True, query="Champions League", after="2026-02-09", sort_by_date=True, limit=10)
  2. Present articles filtered to the last 7 days, sorted newest first
用户:“阿森纳的最新转会新闻是什么?”
  1. 调用
    fetch_items(google_news=True, query="Arsenal transfer news", limit=10)
  2. 展示包含来源、日期和链接的新闻头条
用户:“给我展示BBC Sport的足球头条”
  1. 调用
    fetch_feed(url="https://feeds.bbci.co.uk/sport/football/rss.xml")
  2. 展示订阅源标题、最后更新时间及近期文章
用户:“这周有欧冠相关新闻吗?”
  1. 调用
    fetch_items(google_news=True, query="Champions League", after="2026-02-09", sort_by_date=True, limit=10)
  2. 展示近7天内的文章,并按从新到旧排序

Troubleshooting

故障排除

  • sports-skills
    command not found
    : Package not installed. Run
    pip install sports-skills
    . If pip fails with a Python version error, you need Python 3.10+ — see Setup section.
  • ModuleNotFoundError: No module named 'sports_skills'
    : Same as above — install the package. Prefer the CLI over Python imports to avoid path issues.
  • No results from Google News: Ensure
    google_news=True
    is set AND
    query
    is provided. Without
    query
    , Google News has nothing to search.
  • 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
    after
    parameter (YYYY-MM-DD) to filter to recent articles. Combine with
    sort_by_date=True
    .
  • Non-English results: Set
    language
    (e.g., "pt-BR") and
    country
    (e.g., "BR") for localized Google News results.
  • sports-skills
    命令未找到
    :未安装该包。请运行
    pip install sports-skills
    。若pip因Python版本报错,说明你需要Python 3.10及以上版本——请查看安装配置部分。
  • ModuleNotFoundError: No module named 'sports_skills'
    :同上,请安装该包。推荐使用CLI而非Python导入,以避免路径问题。
  • Google News无结果返回:确保已设置
    google_news=True
    且提供了
    query
    参数。没有
    query
    的话,Google News无法进行搜索。
  • RSS订阅源返回错误:部分订阅源可能会阻止自动化请求或临时下线。可使用Google News作为替代方案。
  • 出现旧文章:使用
    after
    参数(格式:YYYY-MM-DD)筛选近期文章。可结合
    sort_by_date=True
    使用。
  • 返回非英文结果:设置
    language
    (例如"pt-BR")和
    country
    (例如"BR")参数,以获取本地化的Google News结果。