mcpField
O
openfootball

openfootball

github.com/outsharpデータ・データベース4131 回インストール32 週間前に更新
リポジトリ

openfootball について

openfootballは、各地のリーグや大会のサッカー試合データを、無料のパブリックドメインJSONファイルとして公開しています。シーズンとリーグコードを指定して取得でき、APIキーや認証は不要です。

主な機能

  1. 01複数リーグや大会の試合データ
  2. 02シーズンとリーグコードによるJSON取得
  3. 03日程、チーム、スコアの項目
  4. 04GitHub raw URLとPagesミラー
  5. 05認証不要のパブリックドメインデータ

活用シーン

  1. 01リーグの特定シーズンの日程と結果の取得
  2. 02チームや節による試合の絞り込み
  3. 03スコアデータからの順位表作成
  4. 04複数シーズンにわたるチーム成績の集計

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/outsharp/shipp-skills --skill openfootball

インストール後、Claude Code で/openfootballを入力して読み込まれたか確認します。

同梱ファイルREADME.md

詳細

openfootball / football.json API

openfootball は、サッカーのデータを集めた無料のオープンなパブリックドメインのコレクションです。football.json リポジトリでは、世界各地の主要リーグや大会の、あらかじめ作成された JSON ファイルを提供しています。API キーや認証は不要です。


データソース

データにアクセスする方法は 2 つあります。

1. GitHub の Raw URL(主要な方法)
https://raw.githubusercontent.com/openfootball/football.json/master/{season}/{league}.json
2. GitHub Pages ミラー
https://openfootball.github.io/{country}/{season}/{league-name}.json

推奨: football.json リポジトリでは GitHub の Raw URL を使用してください。シンプルで一貫した命名規則が採用されており、最も信頼性が高いためです。


URL の構造

https://raw.githubusercontent.com/openfootball/football.json/master/{season}/{code}.json
コンポーネント説明例
{season}シーズンのディレクトリ。複数年にまたがる形式または暦年形式です2024-25、2023-24、2025、2019
{code}{country}.{division} 形式のリーグコードですen.1、de.1、es.1、it.1、fr.1

利用可能なリーグ

イングランド
コードリーグディビジョン
en.1イングランド・プレミアリーグ1 部
en.2イングランド・チャンピオンシップ2 部
en.3イングランド・リーグ・ワン3 部
en.4イングランド・リーグ・ツー4 部
ドイツ
コードリーグディビジョン
de.1ドイツ・ブンデスリーガ1 部
de.22. ブンデスリーガ2 部
de.33. リーガ3 部
スペイン
コードリーグディビジョン
es.1プリメーラ・ディビシオン(ラ・リーガ)1 部
es.2セグンダ・ディビシオン2 部
イタリア
コードリーグディビジョン
it.1セリエ A1 部
it.2セリエ B2 部
フランス
コードリーグディビジョン
fr.1リーグ・アン1 部
fr.2リーグ・ドゥ2 部

注: すべてのリーグがすべてのシーズンで利用できるわけではありません。football.json リポジトリは継続的に更新されています。利用可能なファイルの全一覧はリポジトリを確認してください。


利用可能なシーズン

football.json リポジトリのシーズンディレクトリは、2010-11 までさかのぼります。ヨーロッパのリーグでは複数年にまたがる形式(2024-25)を使用し、一方で暦年制のリーグでは単一年形式(2025)を使用する場合があります。

形式用途例
YYYY-YYヨーロッパのクラブのシーズン(8 月~5 月)2024-25、2023-24、2015-16
YYYY暦年制の大会2025、2020、2019

既知のシーズンディレクトリ:2010-11、2011-12、2012-13、2013-14、2014-15、2015-16、2016-17、2017-18、2018-19、2019-20、2020-21、2021-22、2022-23、2023-24、2024-25、2025-26、2019、2020、2025。


JSON レスポンス形式

すべてのファイルで同じ JSON スキーマが使用されています。

{
  "name": "English Premier League 2024/25",
  "matches": [
    {
      "round": "Matchday 1",
      "date": "2024-08-16",
      "time": "20:00",
      "team1": "Manchester United FC",
      "team2": "Fulham FC",
      "score": {
        "ht": [0, 0],
        "ft": [1, 0]
      }
    }
  ]
}
トップレベルのフィールド
フィールド型説明
namestring人が読み取れる形式のリーグ名とシーズン
matchesarray試合オブジェクトの配列
試合オブジェクトのフィールド
フィールド型必須説明
roundstringはいラウンド/節の名称(例:"Matchday 1"、"Round of 16")
datestringはいYYYY-MM-DD 形式の試合日
timestringいいえHH:MM 形式のキックオフ時刻(24 時間表記、現地時間)
team1stringはいホームチーム名
team2stringはいアウェイチーム名
scoreobjectいいえスコアオブジェクト(未実施の将来の試合では存在しません)
statusstringいいえ特別なステータス(例:事務手続きにより結果が決定された場合の "awarded")
スコアオブジェクトのフィールド
フィールド型説明
ft[int, int]フルタイムのスコア [home, away]
ht[int, int]ハーフタイムのスコア [home, away](一部の試合では存在しない場合があります)

注: 一部の試合では、ハーフタイムの ht がなく、フルタイムの ft のみが記録されています。アクセスする前に、必ず ht が存在するか確認してください。


よくあるパターン

リーグのシーズンを取得する(curl)
curl -s "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json" | jq .
試合データを取得して解析する(Python)
import requests

url = "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json"
data = requests.get(url).json()

print(f"League: {data['name']}")
print(f"Total matches: {len(data['matches'])}")

for match in data["matches"][:10]:
    ft = match.get("score", {}).get("ft")
    if ft:
        print(f"  {match['date']}  {match['team1']} {ft[0]}-{ft[1]} {match['team2']}")
    else:
        print(f"  {match['date']}  {match['team1']} vs {match['team2']} (no score)")
試合結果からリーグ順位表を作成する(Python)
import requests
from collections import defaultdict

url = "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json"
data = requests.get(url).json()

table = defaultdict(lambda: {"played": 0, "won": 0, "drawn": 0, "lost": 0,
                              "gf": 0, "ga": 0, "points": 0})

for match in data["matches"]:
    score = match.get("score", {}).get("ft")
    if not score:
        continue

    t1, t2 = match["team1"], match["team2"]
    g1, g2 = score

    for team, gf, ga in [(t1, g1, g2), (t2, g2, g1)]:
        table[team]["played"] += 1
        table[team]["gf"] += gf
        table[team]["ga"] += ga
        if gf > ga:
            table[team]["won"] += 1
            table[team]["points"] += 3
        elif gf == ga:
            table[team]["drawn"] += 1
            table[team]["points"] += 1
        else:
            table[team]["lost"] += 1

# Sort by points, then goal difference
sorted_table = sorted(table.items(),
                       key=lambda x: (x[1]["points"], x[1]["gf"] - x[1]["ga"]),
                       reverse=True)

print(f"{'Team':<35} {'P':>3} {'W':>3} {'D':>3} {'L':>3} {'GF':>4} {'GA':>4} {'GD':>4} {'Pts':>4}")
print("-" * 70)
for i, (team, stats) in enumerate(sorted_table, 1):
    gd = stats["gf"] - stats["ga"]
    print(f"{i:>2}. {team:<32} {stats['played']:>3} {stats['won']:>3} "
          f"{stats['drawn']:>3} {stats['lost']:>3} {stats['gf']:>4} "
          f"{stats['ga']:>4} {gd:>+4} {stats['points']:>4}")
チームで試合を絞り込む(Python)
import requests

url = "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json"
data = requests.get(url).json()

team = "Arsenal FC"
matches = [m for m in data["matches"]
           if team in (m["team1"], m["team2"]) and m.get("score", {}).get("ft")]

for m in matches:
    ft = m["score"]["ft"]
    opponent = m["team2"] if m["team1"] == team else m["team1"]
    venue = "H" if m["team1"] == team else "A"
    my_goals = ft[0] if m["team1"] == team else ft[1]
    opp_goals = ft[1] if m["team1"] == team else ft[0]
    result = "W" if my_goals > opp_goals else ("D" if my_goals == opp_goals else "L")
    print(f"  {m['date']} ({venue}) {result} {my_goals}-{opp_goals} vs {opponent}")
複数のリーグを取得する(Python)
import requests

leagues = {
    "Premier League": "en.1",
    "Bundesliga": "de.1",
    "La Liga": "es.1",
    "Serie A": "it.1",
    "Ligue 1": "fr.1",
}

season = "2024-25"
base = "https://raw.githubusercontent.com/openfootball/football.json/master"

for name, code in leagues.items():
    url = f"{base}/{season}/{code}.json"
    resp = requests.get(url)
    if resp.status_code == 200:
        data = resp.json()
        total = len(data["matches"])
        played = sum(1 for m in data["matches"] if m.get("score", {}).get("ft"))
        print(f"{name}: {played}/{total} matches played")
    else:
        print(f"{name}: not available for {season}")
取得して解析する(Node.js)
const url = "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json";

const res = await fetch(url);
const data = await res.json();

console.log(`League: ${data.name}`);
console.log(`Matches: ${data.matches.length}`);

data.matches.slice(0, 10).forEach((m) => {
  const ft = m.score?.ft;
  if (ft) {
    console.log(`  ${m.date}  ${m.team1} ${ft[0]}-${ft[1]} ${m.team2}`);
  }
});
取得して解析する(bash + jq)
# Get all results for a specific team
curl -s "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json" \
  | jq -r '.matches[]
    | select(.team1 == "Liverpool FC" or .team2 == "Liverpool FC")
    | select(.score.ft)
    | "\(.date) \(.team1) \(.score.ft[0])-\(.score.ft[1]) \(.team2)"'
直接対決の結果を比較する(Python)
import requests

url = "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json"
data = requests.get(url).json()

team_a = "Arsenal FC"
team_b = "Liverpool FC"

h2h = [m for m in data["matches"]
       if {m["team1"], m["team2"]} == {team_a, team_b}
       and m.get("score", {}).get("ft")]

for m in h2h:
    ft = m["score"]["ft"]
    ht = m["score"].get("ht", ["?", "?"])
    print(f"{m['date']}: {m['team1']} {ft[0]}-{ft[1]} {m['team2']} (HT: {ht[0]}-{ht[1]})")
複数シーズンの統計を集計する(Python)
import requests

base = "https://raw.githubusercontent.com/openfootball/football.json/master"
seasons = ["2022-23", "2023-24", "2024-25"]
team = "Manchester City FC"
all_results = {"W": 0, "D": 0, "L": 0, "GF": 0, "GA": 0}

for season in seasons:
    resp = requests.get(f"{base}/{season}/en.1.json")
    if resp.status_code != 200:
        continue
    data = resp.json()
    for m in data["matches"]:
        ft = m.get("score", {}).get("ft")
        if not ft:
            continue
        if m["team1"] == team:
            gf, ga = ft
        elif m["team2"] == team:
            ga, gf = ft
        else:
            continue
        all_results["GF"] += gf
        all_results["GA"] += ga
        if gf > ga:
            all_results["W"] += 1
        elif gf == ga:
            all_results["D"] += 1
        else:
            all_results["L"] += 1

print(f"{team} across {', '.join(seasons)}:")
print(f"  W{all_results['W']} D{all_results['D']} L{all_results['L']}")
print(f"  Goals: {all_results['GF']} scored, {all_results['GA']} conceded")
得点の多い試合を見つける(bash + jq)
# Find all matches with 5+ total goals in the Premier League 2024/25
curl -s "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json" \
  | jq -r '.matches[]
    | select(.score.ft)
    | select((.score.ft[0] + .score.ft[1]) >= 5)
    | "\(.date) \(.team1) \(.score.ft[0])-\(.score.ft[1]) \(.team2) (Total: \(.score.ft[0] + .score.ft[1]))"'
特定の節の試合結果を取得する(Python)
import requests

url = "https://raw.githubusercontent.com/openfootball/football.json/master/2024-25/en.1.json"
data = requests.get(url).json()

matchday = "Matchday 38"
matches = [m for m in data["matches"] if m["round"] == matchday]

print(f"--- {matchday} ---")
for m in matches:
    ft = m.get("score", {}).get("ft")
    if ft:
        print(f"  {m['date']} {m.get('time', '')}  {m['team1']} {ft[0]}-{ft[1]} {m['team2']}")
    else:
        print(f"  {m['date']} {m.get('time', '')}  {m['team1']} vs {m['team2']}")

その他のリポジトリ(ソースデータ)

football.json ファイルは、国別リポジトリにあるプレーンテキスト形式の Football.TXT ソースファイルから自動生成されます。

リポジトリ内容GitHub URL
englandEPL、チャンピオンシップ、リーグ・ワン、リーグ・ツーopenfootball/england
deutschlandブンデスリーガ、2. ブンデスリーガ、3. リーガ、DFB ポカールopenfootball/deutschland
espanaラ・リーガ、セグンダ・ディビシオンopenfootball/espana
italyセリエ A、セリエ B、コッパ・イタリアopenfootball/italy
franceリーグ・アン、リーグ・ドゥopenfootball/europe(/europe 内)
worldcupFIFA ワールドカップ(2022、2018、2014 など)openfootball/worldcup
euroEURO 2024、2020、2016 などopenfootball/euro
champions-leagueUCL、ヨーロッパリーグopenfootball/champions-league
clubsクラブおよびスタジアムのメタデータopenfootball/clubs
world北米、アジア、アフリカ、オーストラリアのリーグopenfootball/world

国別リポジトリには、それぞれ独自の GitHub Pages JSON ミラーもあります。たとえば、次のようになります。

https://openfootball.github.io/england/2024-25/1-premierleague.json

fbtxt2json CLI ツールを使って、Football.TXT のソースファイルを自分で JSON に変換できます。

# Convert a single league file
fbtxt2json england/2025-26/1-premierleague.txt -o en.1.json

# Convert an entire country repo at once
fbtxt2json . -o ./_site

レート制限

GitHub は raw コンテンツの具体的なレート制限を公開していませんが、一般的なガイドラインは次のとおりです。

ガイドライン推奨事項
ポーリング間隔同じファイルへのリクエスト間隔を 60 秒以上にする
同時リクエスト数適切な範囲に保つ(同時実行数は 20 未満)
キャッシュレスポンスをローカルにキャッシュする — データは頻繁には変更されません
認証なしの GitHub APIIP あたり 1 時間に 60 リクエスト(API エンドポイントのみに適用され、raw コンテンツには適用されません)

Tip: 試合データは試合終了後に変更されないため、過去のシーズンは積極的にキャッシュできます。更新確認のためのポーリングは、現行シーズンのみにしてください。


エラー処理

HTTP ステータス意味対応
200成功JSON を解析する
404ファイルが見つかりませんシーズン、リーグコード、URL のスペルを確認する
429レート制限待機してから再試行する
5xxサーバーエラー指数バックオフを使って再試行する

ヒント

  • 認証は不要です — すべてのデータは完全に公開されています。すぐに取得を開始できます。
  • アクセスする前に score を確認してください — 将来の試合や未開催の試合には score フィールドがありません。
  • ht も個別に確認してください — ft はあっても ht のデータがない試合があります。
  • チーム名には接尾辞が含まれます — 例:"Arsenal FC"、"Manchester United FC"、"Borussia Dortmund"。完全一致で検索してください。
  • チーム名はリーグによって異なります — ドイツのチームはドイツ語名("FC Bayern München")、イングランドのチームは英語名("Arsenal FC")を使用します。
  • status フィールドはまれです — 管理上の決定によって結果が決まった試合(例:"awarded")に表示されます。
  • 積極的にキャッシュしてください — 完了したシーズンのデータは変更されません。更新されるのは現在のシーズンのみです。
  • データから表を作成してください — データセットには試合結果の生データが含まれています。順位表、調子、直接対決などは計算してください。
  • リーグを相互参照してください — 複数のリーグファイルを取得して、国をまたいで比較できます。
  • パブリックドメイン(CC0)です — 制限は一切なく、データを自由に利用できます。
  • JSONを直接編集しないでください — 貢献する場合は、各国のリポジトリにあるFootball.TXTのソースファイルを編集してください。JSONは自動生成されます。
  • 時刻フィールドは現地時間です — time の値は、試合会場の現地キックオフ時刻を表します。
  • スコアは [home, away] の形式です — score.ft[0] は常に team1(ホーム)の得点、score.ft[1] は常に team2(アウェイ)の得点です。

変更履歴

  • 0.1.0 — リーグデータへのアクセス、JSONスキーマのドキュメント、一般的な使用パターンを含む初回リリース。

コメント