crawlora-yahoo-sports 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +93 -0
- data/lib/crawlora/yahoo-sports/client.rb +408 -0
- data/lib/crawlora/yahoo-sports/version.rb +5 -0
- data/lib/crawlora/yahoo-sports.rb +2 -0
- metadata +52 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e549bbd6ca636d75423f61173f9651bba59614eb97156d4f520bb0d398a2850c
|
|
4
|
+
data.tar.gz: e605350a971ca485c51044c794d6a54da0fbb93881d2129323987d5dc8454e05
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2269bbe6c1273d64a8c39d65f78e4c9ab72bc94ad760d58446a807f24f8f30454e9622ed717972cfc1667e41add34d25bda60b4d102d40d730f1caa21ca4296c
|
|
7
|
+
data.tar.gz: 41df50b97f9f389bd5095ef49591e05fa393548fb934f9b792ab98ba1a7f159cf7114b6b2806b22e683a0685a6d6f150b33fbea089ff2e400acebb40eccc6635
|
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crawlora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Crawlora Yahoo Sports API client for Ruby (`crawlora-yahoo-sports`)
|
|
2
|
+
|
|
3
|
+
This Ruby gem calls Crawlora's hosted Yahoo Sports API at `https://api.crawlora.net/api/v1`. It exposes 53 endpoints covering league, team, player, game, schedule, standings, rankings, and fantasy sports data; it does not call or scrape Yahoo Sports directly. Requests require your Crawlora API key and use your account's service plan.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
gem "crawlora-yahoo-sports"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Create an account at [crawlora.net](https://crawlora.net/signup?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=yahoo-sports-ruby-signup), open the [Crawlora console](https://crawlora.net/app?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=yahoo-sports-ruby-console) to get an API key, and set `CRAWLORA_API_KEY` before running the client:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require "json"
|
|
15
|
+
require "crawlora/yahoo-sports"
|
|
16
|
+
|
|
17
|
+
client = Crawlora::YahooSports::Client.new
|
|
18
|
+
result = client.request("yahoo-sports-player-search", JSON.parse("{\"league\": \"nfl\", \"name\": \"sample\"}"))
|
|
19
|
+
puts result
|
|
20
|
+
client.close
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use an operation-specific method for normal calls. `request(operation_id, params = {}, response_type: :auto)` is available for every operation. `response_type: :text` returns raw response text. This gem includes 53 API operations.
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
client = Crawlora::YahooSports::Client.new(api_key: ENV.fetch("CRAWLORA_API_KEY"), timeout: 30)
|
|
27
|
+
# client.<operation_method>(<endpoint parameters>)
|
|
28
|
+
client.close
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Client options include `api_key`, `base_url`, and `timeout`. Ruby stdlib provides the HTTP and JSON support.
|
|
32
|
+
|
|
33
|
+
## Supported Yahoo Sports API endpoints
|
|
34
|
+
|
|
35
|
+
Browse every route included in this gem. The [endpoint reference](https://github.com/Crawlora-org/crawlora-yahoo-sports/blob/main/docs/usage.md) includes parameter and response details.
|
|
36
|
+
|
|
37
|
+
| Method | Endpoint | API operation | Description |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| `GET` | `/yahoo-sports/college-rankings` | `yahoo-sports-college-rankings` | Yahoo Sports college football and basketball rankings |
|
|
40
|
+
| `GET` | `/yahoo-sports/draft` | `yahoo-sports-draft` | Yahoo Sports NFL and NBA Draft hub |
|
|
41
|
+
| `GET` | `/yahoo-sports/dropdown-catalog` | `yahoo-sports-dropdown-catalog` | Yahoo Sports team and category dropdown data |
|
|
42
|
+
| `GET` | `/yahoo-sports/game` | `yahoo-sports-game` | Yahoo Sports game boxscore |
|
|
43
|
+
| `GET` | `/yahoo-sports/golf-leaderboard` | `yahoo-sports-golf-leaderboard` | Yahoo Sports golf tournament leaderboard |
|
|
44
|
+
| `GET` | `/yahoo-sports/golf-player` | `yahoo-sports-golf-player` | Yahoo Sports golf player profile |
|
|
45
|
+
| `GET` | `/yahoo-sports/golf-player-news` | `yahoo-sports-golf-player-news` | Yahoo Sports golf player news |
|
|
46
|
+
| `GET` | `/yahoo-sports/golf-players` | `yahoo-sports-golf-players` | Yahoo Sports golf player directory |
|
|
47
|
+
| `GET` | `/yahoo-sports/golf-schedule` | `yahoo-sports-golf-schedule` | Yahoo Sports golf tournament schedule |
|
|
48
|
+
| `GET` | `/yahoo-sports/home` | `yahoo-sports-home` | Yahoo Sports home-page stories |
|
|
49
|
+
| `GET` | `/yahoo-sports/injury-report` | `yahoo-sports-injury-report` | Yahoo Sports injury report |
|
|
50
|
+
| `GET` | `/yahoo-sports/league-schedule` | `yahoo-sports-league-schedule` | Yahoo Sports league schedule games |
|
|
51
|
+
| `GET` | `/yahoo-sports/leagues` | `yahoo-sports-leagues` | Yahoo Sports league catalog |
|
|
52
|
+
| `GET` | `/yahoo-sports/mma-fight-card` | `yahoo-sports-mma-fight-card` | Yahoo Sports MMA fight card |
|
|
53
|
+
| `GET` | `/yahoo-sports/mma-schedule` | `yahoo-sports-mma-schedule` | Yahoo Sports MMA event schedule |
|
|
54
|
+
| `GET` | `/yahoo-sports/more-news` | `yahoo-sports-more-news` | Yahoo Sports More News feed |
|
|
55
|
+
| `GET` | `/yahoo-sports/motorsports-race` | `yahoo-sports-motorsports-race` | Yahoo Sports motorsports race results |
|
|
56
|
+
| `GET` | `/yahoo-sports/motorsports-schedule` | `yahoo-sports-motorsports-schedule` | Yahoo Sports motorsports season schedule |
|
|
57
|
+
| `GET` | `/yahoo-sports/navigation` | `yahoo-sports-navigation` | Yahoo Sports section navigation |
|
|
58
|
+
| `GET` | `/yahoo-sports/network-catalog` | `yahoo-sports-network-catalog` | Yahoo Sports Network and Watch catalog |
|
|
59
|
+
| `GET` | `/yahoo-sports/news` | `yahoo-sports-news` | Yahoo Sports league news |
|
|
60
|
+
| `GET` | `/yahoo-sports/newsletter-archive` | `yahoo-sports-newsletter-archive` | Yahoo Sports newsletter article archive |
|
|
61
|
+
| `GET` | `/yahoo-sports/newsletters` | `yahoo-sports-newsletters` | Yahoo Sports newsletter catalog |
|
|
62
|
+
| `GET` | `/yahoo-sports/odds-featured` | `yahoo-sports-odds-featured` | Yahoo Sports featured odds games |
|
|
63
|
+
| `GET` | `/yahoo-sports/odds-game` | `yahoo-sports-odds-game` | Yahoo Sports game odds markets |
|
|
64
|
+
| `GET` | `/yahoo-sports/odds-games` | `yahoo-sports-odds-games` | Yahoo Sports current game IDs for an odds league |
|
|
65
|
+
| `GET` | `/yahoo-sports/odds-trending` | `yahoo-sports-odds-trending` | Yahoo Sports trending odds games |
|
|
66
|
+
| `GET` | `/yahoo-sports/olympics-medals` | `yahoo-sports-olympics-medals` | Yahoo Sports Olympics medal count |
|
|
67
|
+
| `GET` | `/yahoo-sports/player` | `yahoo-sports-player` | Yahoo Sports player detail |
|
|
68
|
+
| `GET` | `/yahoo-sports/player-search` | `yahoo-sports-player-search` | Yahoo Sports player search |
|
|
69
|
+
| `GET` | `/yahoo-sports/playoff-bracket` | `yahoo-sports-playoff-bracket` | Yahoo Sports playoff bracket data |
|
|
70
|
+
| `GET` | `/yahoo-sports/playoff-bracket-catalog` | `yahoo-sports-playoff-bracket-catalog` | Yahoo Sports playoff bracket season options |
|
|
71
|
+
| `GET` | `/yahoo-sports/rss-catalog` | `yahoo-sports-rss-catalog` | Yahoo Sports RSS feed catalog |
|
|
72
|
+
| `GET` | `/yahoo-sports/rss-feed` | `yahoo-sports-rss-feed` | Yahoo Sports RSS feed |
|
|
73
|
+
| `GET` | `/yahoo-sports/schedule-catalog` | `yahoo-sports-schedule-catalog` | Yahoo Sports league schedule filter catalog |
|
|
74
|
+
| `GET` | `/yahoo-sports/scoreboard` | `yahoo-sports-scoreboard` | Yahoo Sports scoreboard |
|
|
75
|
+
| `GET` | `/yahoo-sports/section-stream` | `yahoo-sports-section-stream` | Yahoo Sports public section article stream |
|
|
76
|
+
| `GET` | `/yahoo-sports/soccer-scoreboard` | `yahoo-sports-soccer-scoreboard` | Yahoo Sports all-competition soccer scoreboard |
|
|
77
|
+
| `GET` | `/yahoo-sports/sportsbook-catalog` | `yahoo-sports-sportsbook-catalog` | Yahoo Sports odds page filter catalog |
|
|
78
|
+
| `GET` | `/yahoo-sports/standings` | `yahoo-sports-standings` | Yahoo Sports standings |
|
|
79
|
+
| `GET` | `/yahoo-sports/stats` | `yahoo-sports-stats` | Yahoo Sports league stats table |
|
|
80
|
+
| `GET` | `/yahoo-sports/stats-catalog` | `yahoo-sports-stats-catalog` | Yahoo Sports stats league catalog |
|
|
81
|
+
| `GET` | `/yahoo-sports/stats-discovery` | `yahoo-sports-stats-discovery` | Yahoo Sports stats tabs and filters |
|
|
82
|
+
| `GET` | `/yahoo-sports/team` | `yahoo-sports-team` | Yahoo Sports team detail |
|
|
83
|
+
| `GET` | `/yahoo-sports/team-roster` | `yahoo-sports-team-roster` | Yahoo Sports team roster |
|
|
84
|
+
| `GET` | `/yahoo-sports/team-schedule` | `yahoo-sports-team-schedule` | Yahoo Sports team schedule |
|
|
85
|
+
| `GET` | `/yahoo-sports/tennis-rankings` | `yahoo-sports-tennis-rankings` | Yahoo Sports tennis rankings |
|
|
86
|
+
| `GET` | `/yahoo-sports/tennis-schedule` | `yahoo-sports-tennis-schedule` | Yahoo Sports tennis tournament schedule |
|
|
87
|
+
| `GET` | `/yahoo-sports/tennis-scoreboard` | `yahoo-sports-tennis-scoreboard` | Yahoo Sports tennis scoreboard |
|
|
88
|
+
| `GET` | `/yahoo-sports/topic-news` | `yahoo-sports-topic-news` | Yahoo Sports topic news |
|
|
89
|
+
| `GET` | `/yahoo-sports/video-headlines` | `yahoo-sports-video-headlines` | Yahoo Sports video headlines |
|
|
90
|
+
| `GET` | `/yahoo-sports/video-list-catalog` | `yahoo-sports-video-list-catalog` | Yahoo Sports video-list catalog |
|
|
91
|
+
| `GET` | `/yahoo-sports/watch-schedule` | `yahoo-sports-watch-schedule` | Yahoo Sports TV schedule |
|
|
92
|
+
|
|
93
|
+
See [Crawlora](https://crawlora.net/?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=yahoo-sports-ruby-homepage), the [API documentation](https://crawlora.net/docs?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=yahoo-sports-ruby-api-docs), and [the package repository](https://github.com/Crawlora-org/crawlora-yahoo-sports) for account setup, the API operation reference, and release history.
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "uri"
|
|
4
|
+
|
|
5
|
+
module Crawlora
|
|
6
|
+
module YahooSports
|
|
7
|
+
module Errors
|
|
8
|
+
class Error < StandardError
|
|
9
|
+
attr_reader :status, :operation_id, :body
|
|
10
|
+
|
|
11
|
+
def initialize(message, status: nil, operation_id: nil, body: nil)
|
|
12
|
+
super(message)
|
|
13
|
+
@status, @operation_id, @body = status, operation_id, body
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
class ClientError < Error; end
|
|
17
|
+
class ServerError < Error; end
|
|
18
|
+
class NetworkError < Error; end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
OPERATIONS = JSON.parse(<<~'JSON').freeze
|
|
22
|
+
{"yahoo-sports-college-rankings": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-college-rankings", "method": "GET", "params": [{"description": "College ranking league", "enum": ["college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "college-football"}, {"description": "Exact Poll Type value from the live rankings filter catalog; defaults to the page's current poll", "in": "query", "name": "poll_type", "type": "string", "x-example": "AP_TOP_25"}, {"description": "Exact Poll Date selector value from the live catalog (college football only)", "in": "query", "name": "date", "type": "string", "x-example": "2026-10-25-07:00"}, {"description": "Optional IANA timezone for game times embedded in ranking rows; defaults to UTC", "in": "query", "name": "tz", "type": "string", "x-example": "Asia/Shanghai"}], "path": "/yahoo-sports/college-rankings", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "poll_type", "type": "string"}, {"in": "query", "name": "date", "type": "string"}, {"in": "query", "name": "tz", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-draft": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-draft", "method": "GET", "params": [{"description": "Yahoo draft league; use yahoo-sports-leagues (draft=true)", "enum": ["nfl", "nba"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Yahoo Draft page: results, mock, big-board, or news; defaults to results", "enum": ["results", "mock", "big-board", "news"], "in": "query", "name": "view", "type": "string", "x-example": "results"}], "path": "/yahoo-sports/draft", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba"], "in": "query", "name": "league", "required": true, "type": "string"}, {"enum": ["results", "mock", "big-board", "news"], "in": "query", "name": "view", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-dropdown-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-dropdown-catalog", "method": "GET", "params": [], "path": "/yahoo-sports/dropdown-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-game": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-game", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "mlb"}, {"description": "Yahoo game slug for direct league pages; supply game or game_url", "in": "query", "name": "game", "type": "string", "x-example": "cleveland-guardians-detroit-tigers-460811106"}, {"description": "Exact game.url from a soccer scoreboard; requires league=soccer and cannot be combined with game", "in": "query", "name": "game_url", "type": "string", "x-example": "https://sports.yahoo.com/soccer/european-championship-finals/belgium-france-13514469/"}], "path": "/yahoo-sports/game", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "game", "type": "string"}, {"in": "query", "name": "game_url", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-golf-leaderboard": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-golf-leaderboard", "method": "GET", "params": [{"description": "Yahoo Sports golf tournament id from a golf-schedule response's id field", "in": "query", "name": "tournament", "required": true, "type": "string", "x-example": "golf.e.23"}, {"description": "4-digit season year (a tournament id is reused across years); defaults to the tournament's most recent season", "in": "query", "name": "season", "type": "integer", "x-example": 2026}], "path": "/yahoo-sports/golf-leaderboard", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "tournament", "required": true, "type": "string"}, {"in": "query", "name": "season", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-golf-player": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-golf-player", "method": "GET", "params": [{"description": "Canonical Yahoo Golf player profile URL", "in": "query", "name": "player_url", "required": true, "type": "string", "x-example": "https://sports.yahoo.com/golf/players/Ludvig+Aberg/22880/"}], "path": "/yahoo-sports/golf-player", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "player_url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-golf-player-news": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-golf-player-news", "method": "GET", "params": [{"description": "Canonical Yahoo Golf player URL", "in": "query", "name": "player_url", "required": true, "type": "string", "x-example": "https://sports.yahoo.com/golf/players/Ludvig+Aberg/22880/"}, {"description": "Top News or Latest", "enum": ["top", "latest"], "in": "query", "name": "mode", "type": "string", "x-example": "latest"}, {"description": "Opaque next_cursor returned by a previous latest response", "in": "query", "name": "cursor", "type": "string"}], "path": "/yahoo-sports/golf-player-news", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "player_url", "required": true, "type": "string"}, {"enum": ["top", "latest"], "in": "query", "name": "mode", "type": "string"}, {"in": "query", "name": "cursor", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-golf-players": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-golf-players", "method": "GET", "params": [], "path": "/yahoo-sports/golf-players", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-golf-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-golf-schedule", "method": "GET", "params": [{"description": "Golf tour key", "enum": ["pga-tour", "pga-european-tours", "lpga-tour", "champions-tour", "european-tour", "korn-ferry-tour"], "in": "query", "name": "tour", "required": true, "type": "string", "x-example": "pga-tour"}, {"description": "4-digit season year; defaults to the tour's current season", "in": "query", "name": "season", "type": "integer", "x-example": 2026}], "path": "/yahoo-sports/golf-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["pga-tour", "pga-european-tours", "lpga-tour", "champions-tour", "european-tour", "korn-ferry-tour"], "in": "query", "name": "tour", "required": true, "type": "string"}, {"in": "query", "name": "season", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-home": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-home", "method": "GET", "params": [], "path": "/yahoo-sports/home", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-injury-report": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-injury-report", "method": "GET", "params": [{"description": "League with an injury page", "enum": ["nfl", "nba", "mlb", "nhl"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nba"}, {"description": "Optional Yahoo team ID from yahoo-sports-dropdown-catalog; omit for All Teams", "in": "query", "name": "team_id", "type": "string", "x-example": "nba.t.21"}], "path": "/yahoo-sports/injury-report", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "nhl"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "team_id", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-league-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-league-schedule", "method": "GET", "params": [{"description": "Yahoo league key", "enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Optional season year from yahoo-sports-schedule-catalog", "in": "query", "name": "season", "type": "integer", "x-example": 2026}, {"description": "Optional date filter in YYYY-MM-DD form; for schedule pages with date tabs", "in": "query", "name": "date", "type": "string", "x-example": "2026-10-04"}, {"description": "Optional week value from yahoo-sports-schedule-catalog", "in": "query", "name": "week", "type": "integer", "x-example": 9}, {"description": "Optional week phase from the catalog", "enum": ["PRESEASON", "REGULAR_SEASON", "POSTSEASON"], "in": "query", "name": "seasonPhase", "type": "string", "x-example": "REGULAR_SEASON"}, {"description": "Exact leagueFilter value from the schedule catalog (NCAAF/NCAAB/NCAAW conference, division or Top 25 option)", "in": "query", "name": "leagueFilter", "type": "string"}], "path": "/yahoo-sports/league-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "season", "type": "integer"}, {"in": "query", "name": "date", "type": "string"}, {"in": "query", "name": "week", "type": "integer"}, {"enum": ["PRESEASON", "REGULAR_SEASON", "POSTSEASON"], "in": "query", "name": "seasonPhase", "type": "string"}, {"in": "query", "name": "leagueFilter", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-leagues": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-leagues", "method": "GET", "params": [], "path": "/yahoo-sports/leagues", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-mma-fight-card": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-mma-fight-card", "method": "GET", "params": [], "path": "/yahoo-sports/mma-fight-card", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-mma-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-mma-schedule", "method": "GET", "params": [], "path": "/yahoo-sports/mma-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-more-news": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-more-news", "method": "GET", "params": [{"default": 1, "description": "1-based Yahoo More News page number; defaults to 1", "in": "query", "minimum": 1, "name": "page", "type": "integer", "x-example": 2}], "path": "/yahoo-sports/more-news", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-motorsports-race": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-motorsports-race", "method": "GET", "params": [{"description": "Motorsports series key", "enum": ["f1", "nascar"], "in": "query", "name": "series", "required": true, "type": "string", "x-example": "f1"}, {"description": "Yahoo Sports race slug from a motorsports-schedule response's race url", "in": "query", "name": "race", "required": true, "type": "string", "x-example": "australian-grand-prix-2026-2961"}], "path": "/yahoo-sports/motorsports-race", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["f1", "nascar"], "in": "query", "name": "series", "required": true, "type": "string"}, {"in": "query", "name": "race", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-motorsports-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-motorsports-schedule", "method": "GET", "params": [{"description": "Motorsports series key", "enum": ["f1", "nascar"], "in": "query", "name": "series", "required": true, "type": "string", "x-example": "f1"}, {"description": "4-digit season year; defaults to the current season", "in": "query", "name": "season", "type": "integer", "x-example": 2026}], "path": "/yahoo-sports/motorsports-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["f1", "nascar"], "in": "query", "name": "series", "required": true, "type": "string"}, {"in": "query", "name": "season", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-navigation": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-navigation", "method": "GET", "params": [{"description": "Full Yahoo Sports page URL; leave blank for home navigation", "in": "query", "name": "section_url", "type": "string", "x-example": "https://sports.yahoo.com/golf/"}], "path": "/yahoo-sports/navigation", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "section_url", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-network-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-network-catalog", "method": "GET", "params": [], "path": "/yahoo-sports/network-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-news": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-news", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}], "path": "/yahoo-sports/news", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-newsletter-archive": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-newsletter-archive", "method": "GET", "params": [{"description": "Newsletter slug from yahoo-sports-newsletters", "in": "query", "name": "newsletter", "required": true, "type": "string", "x-example": "yahoo-sports-am"}, {"default": 1, "description": "1-based Yahoo archive page number; defaults to 1", "in": "query", "minimum": 1, "name": "page", "type": "integer", "x-example": 2}], "path": "/yahoo-sports/newsletter-archive", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "newsletter", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-newsletters": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-newsletters", "method": "GET", "params": [], "path": "/yahoo-sports/newsletters", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-odds-featured": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-odds-featured", "method": "GET", "params": [], "path": "/yahoo-sports/odds-featured", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-odds-game": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-odds-game", "method": "GET", "params": [{"description": "Yahoo game ID from an odds game list", "in": "query", "name": "game_id", "required": true, "type": "string", "x-example": "nfl.g.20261101002"}, {"description": "Optional IANA timezone for game time display; defaults to UTC", "in": "query", "name": "tz", "type": "string", "x-example": "Asia/Shanghai"}], "path": "/yahoo-sports/odds-game", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "game_id", "required": true, "type": "string"}, {"in": "query", "name": "tz", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-odds-games": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-odds-games", "method": "GET", "params": [{"description": "Exact Graphite league value from yahoo-sports-sportsbook-catalog", "enum": ["nfl", "ncaaf", "nba", "mlb", "nhl", "ncaab", "ncaaw", "wnba", "soccer.l.fbgb", "soccer.l.fbchampions", "soccer.l.mls", "soccer.l.fbes", "soccer.l.fbwcup", "golf", "ten"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}], "path": "/yahoo-sports/odds-games", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "ncaaf", "nba", "mlb", "nhl", "ncaab", "ncaaw", "wnba", "soccer.l.fbgb", "soccer.l.fbchampions", "soccer.l.mls", "soccer.l.fbes", "soccer.l.fbwcup", "golf", "ten"], "in": "query", "name": "league", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-odds-trending": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-odds-trending", "method": "GET", "params": [], "path": "/yahoo-sports/odds-trending", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-olympics-medals": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-olympics-medals", "method": "GET", "params": [], "path": "/yahoo-sports/olympics-medals", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-player": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-player", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Numeric Yahoo Sports player id", "in": "query", "name": "player", "required": true, "type": "string", "x-example": "42019"}], "path": "/yahoo-sports/player", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "player", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-player-search": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-player-search", "method": "GET", "params": [{"description": "Player-search page key", "enum": ["nfl", "nba", "mlb", "golf"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nba"}, {"description": "Player name or prefix (at least three characters)", "in": "query", "name": "name", "required": true, "type": "string", "x-example": "LeBron"}], "path": "/yahoo-sports/player-search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "golf"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "name", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-playoff-bracket": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-playoff-bracket", "method": "GET", "params": [{"description": "Yahoo league key", "enum": ["nfl", "nba", "mlb", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nba"}, {"description": "Optional season year from yahoo-sports-playoff-bracket-catalog; defaults to Yahoo's current season", "in": "query", "name": "season", "type": "integer", "x-example": 2025}], "path": "/yahoo-sports/playoff-bracket", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "season", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-playoff-bracket-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-playoff-bracket-catalog", "method": "GET", "params": [{"description": "Yahoo league key", "enum": ["nfl", "nba", "mlb", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nba"}], "path": "/yahoo-sports/playoff-bracket-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-rss-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-rss-catalog", "method": "GET", "params": [], "path": "/yahoo-sports/rss-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-rss-feed": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-rss-feed", "method": "GET", "params": [{"description": "Feed key from yahoo-sports-rss-catalog", "in": "query", "name": "feed", "required": true, "type": "string", "x-example": "general-news"}], "path": "/yahoo-sports/rss-feed", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "feed", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-schedule-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-schedule-catalog", "method": "GET", "params": [{"description": "Yahoo league key", "enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}], "path": "/yahoo-sports/schedule-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "college-womens-basketball"], "in": "query", "name": "league", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-scoreboard": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-scoreboard", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Date as YYYY-MM-DD; defaults to Yahoo Sports' current scoreboard date", "in": "query", "name": "date", "type": "string", "x-example": "2026-08-13"}, {"description": "Optional root soccer scoreboard month from 1 to 12; only with league=soccer", "in": "query", "name": "month", "type": "integer", "x-example": 11}, {"description": "Exact source competition id from yahoo-sports-soccer-scoreboard; only with league=soccer", "in": "query", "name": "competition_id", "type": "string", "x-example": "soccer.l.fbgb"}, {"description": "Optional season year for a direct soccer competition page; discover values from yahoo-sports-soccer-scoreboard", "in": "query", "name": "season", "type": "integer", "x-example": 2025}], "path": "/yahoo-sports/scoreboard", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "date", "type": "string"}, {"in": "query", "name": "month", "type": "integer"}, {"in": "query", "name": "competition_id", "type": "string"}, {"in": "query", "name": "season", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-section-stream": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-section-stream", "method": "GET", "params": [{"description": "Full HTTPS Yahoo Sports article-list URL from yahoo-sports-navigation", "in": "query", "name": "section_url", "required": true, "type": "string", "x-example": "https://sports.yahoo.com/indycar/"}, {"description": "Exact upstream pageOffset. Defaults to the section page's initial offset; use page_info.start + page_info.count for the next page", "in": "query", "name": "page_offset", "type": "integer", "x-example": 10}], "path": "/yahoo-sports/section-stream", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "section_url", "required": true, "type": "string"}, {"in": "query", "name": "page_offset", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-soccer-scoreboard": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-soccer-scoreboard", "method": "GET", "params": [{"description": "Date as YYYY-MM-DD; defaults to Yahoo Sports' current soccer scoreboard date", "in": "query", "name": "date", "type": "string", "x-example": "2026-11-01"}, {"description": "Optional Yahoo soccer scoreboard month number (1–12); may be combined with date", "in": "query", "name": "month", "type": "integer", "x-example": 10}, {"description": "Exact source competition id from this response's competitions catalog; mirrors the page's client-side selector", "in": "query", "name": "competition_id", "type": "string", "x-example": "soccer.l.fbgb"}], "path": "/yahoo-sports/soccer-scoreboard", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "date", "type": "string"}, {"in": "query", "name": "month", "type": "integer"}, {"in": "query", "name": "competition_id", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-sportsbook-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-sportsbook-catalog", "method": "GET", "params": [], "path": "/yahoo-sports/sportsbook-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-standings": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-standings", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "world-cup", "europa-league"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "mlb"}, {"description": "Optional soccer standings season from yahoo-sports-soccer-scoreboard", "in": "query", "name": "season", "type": "integer", "x-example": 2026}], "path": "/yahoo-sports/standings", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "world-cup", "europa-league"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "season", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-stats": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-stats", "method": "GET", "params": [{"description": "Stats league key", "enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "ligamx-clausura", "world-cup", "concacaf-gold-cup", "golf"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nba"}, {"description": "Stats page type; defaults to individual", "enum": ["individual", "weekly", "team"], "in": "query", "name": "pageType", "type": "string", "x-example": "individual"}, {"description": "Tab id from the response's tabs list; defaults to 0", "in": "query", "name": "selectedTable", "type": "integer", "x-example": 0}, {"description": "Qualified leaders filter, when listed by stats-discovery", "in": "query", "name": "qualified", "type": "boolean", "x-example": false}, {"description": "Structure id from stats-discovery, e.g. nba.struct.conf.1", "in": "query", "name": "leagueStructure", "type": "string"}, {"description": "Position id from stats-discovery, e.g. POINT_GUARD", "in": "query", "name": "positionIds", "type": "string"}, {"description": "Split/situation id from stats-discovery, e.g. HOME", "in": "query", "name": "cutTypeIds", "type": "string"}, {"description": "Sort id from the response's sort_stat_ids, e.g. TOTAL_REBOUNDS_PER_GAME", "in": "query", "name": "sortStatId", "type": "string"}, {"description": "Week number from stats-discovery; pair with weekSeasonPhase", "in": "query", "name": "week", "type": "integer"}, {"description": "Phase value paired with week, e.g. REGULAR_SEASON or POSTSEASON", "in": "query", "name": "weekSeasonPhase", "type": "string"}], "path": "/yahoo-sports/stats", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "ligamx-clausura", "world-cup", "concacaf-gold-cup", "golf"], "in": "query", "name": "league", "required": true, "type": "string"}, {"enum": ["individual", "weekly", "team"], "in": "query", "name": "pageType", "type": "string"}, {"in": "query", "name": "selectedTable", "type": "integer"}, {"in": "query", "name": "qualified", "type": "boolean"}, {"in": "query", "name": "leagueStructure", "type": "string"}, {"in": "query", "name": "positionIds", "type": "string"}, {"in": "query", "name": "cutTypeIds", "type": "string"}, {"in": "query", "name": "sortStatId", "type": "string"}, {"in": "query", "name": "week", "type": "integer"}, {"in": "query", "name": "weekSeasonPhase", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-stats-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-stats-catalog", "method": "GET", "params": [], "path": "/yahoo-sports/stats-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-stats-discovery": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-stats-discovery", "method": "GET", "params": [{"description": "Stats league key", "enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "ligamx-clausura", "world-cup", "concacaf-gold-cup", "golf"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nba"}, {"description": "Stats page type; defaults to individual", "enum": ["individual", "weekly", "team"], "in": "query", "name": "pageType", "type": "string", "x-example": "individual"}], "path": "/yahoo-sports/stats-discovery", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "mlb", "nhl", "wnba", "college-football", "college-basketball", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "ligamx-clausura", "world-cup", "concacaf-gold-cup", "golf"], "in": "query", "name": "league", "required": true, "type": "string"}, {"enum": ["individual", "weekly", "team"], "in": "query", "name": "pageType", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-team": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-team", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Yahoo Sports team slug", "in": "query", "name": "team", "required": true, "type": "string", "x-example": "green-bay"}], "path": "/yahoo-sports/team", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "team", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-team-roster": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-team-roster", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Yahoo Sports team slug", "in": "query", "name": "team", "required": true, "type": "string", "x-example": "green-bay"}], "path": "/yahoo-sports/team-roster", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "team", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-team-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-team-schedule", "method": "GET", "params": [{"description": "League key", "enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string", "x-example": "nfl"}, {"description": "Yahoo Sports team slug", "in": "query", "name": "team", "required": true, "type": "string", "x-example": "green-bay"}], "path": "/yahoo-sports/team-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["nfl", "nba", "wnba", "mlb", "nhl", "college-football", "college-basketball", "college-womens-basketball", "soccer", "mls", "premier-league", "la-liga", "serie-a", "bundesliga", "ligue-1", "champions-league", "nwsl", "ligamx-apertura", "ligamx-clausura", "copa-america", "club-world-cup", "world-cup", "concacaf-champions-cup", "concacaf-gold-cup", "concacaf-league", "womens-world-cup", "europa-league", "euro-championship"], "in": "query", "name": "league", "required": true, "type": "string"}, {"in": "query", "name": "team", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-tennis-rankings": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-tennis-rankings", "method": "GET", "params": [{"description": "Rankings type", "enum": ["mens-singles", "womens-singles", "mens-doubles", "womens-doubles"], "in": "query", "name": "type", "required": true, "type": "string", "x-example": "mens-singles"}], "path": "/yahoo-sports/tennis-rankings", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["mens-singles", "womens-singles", "mens-doubles", "womens-doubles"], "in": "query", "name": "type", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-tennis-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-tennis-schedule", "method": "GET", "params": [], "path": "/yahoo-sports/tennis-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-tennis-scoreboard": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-tennis-scoreboard", "method": "GET", "params": [], "path": "/yahoo-sports/tennis-scoreboard", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-topic-news": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-topic-news", "method": "GET", "params": [{"description": "Open-ended root topic slug", "in": "query", "name": "topic", "type": "string", "x-example": "how-to-watch"}, {"description": "Full Yahoo Sports topic URL, including sport-scoped topic pages such as /golf/topic/lpga-tour/", "in": "query", "name": "topic_url", "type": "string"}], "path": "/yahoo-sports/topic-news", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "topic", "type": "string"}, {"in": "query", "name": "topic_url", "type": "string"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-video-headlines": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-video-headlines", "method": "GET", "params": [{"description": "Yahoo video list UUID from a Watch or video-show page", "in": "query", "name": "list_id", "required": true, "type": "string", "x-example": "dcb9fa54-438f-4388-ab6c-4ac34fea3df9"}, {"description": "Yahoo page request count: 1 or 6. Defaults to 6.", "enum": [1, 6], "in": "query", "name": "count", "type": "integer", "x-example": 6}], "path": "/yahoo-sports/video-headlines", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "list_id", "required": true, "type": "string"}, {"enum": ["1", "6"], "in": "query", "name": "count", "type": "integer"}], "security": ["ApiKeyAuth"]}, "yahoo-sports-video-list-catalog": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-video-list-catalog", "method": "GET", "params": [], "path": "/yahoo-sports/video-list-catalog", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "yahoo-sports-watch-schedule": {"bodyParam": null, "bodyRequired": false, "id": "yahoo-sports-watch-schedule", "method": "GET", "params": [], "path": "/yahoo-sports/watch-schedule", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}}
|
|
23
|
+
JSON
|
|
24
|
+
OPERATION_IDS = JSON.parse(<<~'JSON').freeze
|
|
25
|
+
["yahoo-sports-college-rankings", "yahoo-sports-draft", "yahoo-sports-dropdown-catalog", "yahoo-sports-game", "yahoo-sports-golf-leaderboard", "yahoo-sports-golf-player", "yahoo-sports-golf-player-news", "yahoo-sports-golf-players", "yahoo-sports-golf-schedule", "yahoo-sports-home", "yahoo-sports-injury-report", "yahoo-sports-league-schedule", "yahoo-sports-leagues", "yahoo-sports-mma-fight-card", "yahoo-sports-mma-schedule", "yahoo-sports-more-news", "yahoo-sports-motorsports-race", "yahoo-sports-motorsports-schedule", "yahoo-sports-navigation", "yahoo-sports-network-catalog", "yahoo-sports-news", "yahoo-sports-newsletter-archive", "yahoo-sports-newsletters", "yahoo-sports-odds-featured", "yahoo-sports-odds-game", "yahoo-sports-odds-games", "yahoo-sports-odds-trending", "yahoo-sports-olympics-medals", "yahoo-sports-player", "yahoo-sports-player-search", "yahoo-sports-playoff-bracket", "yahoo-sports-playoff-bracket-catalog", "yahoo-sports-rss-catalog", "yahoo-sports-rss-feed", "yahoo-sports-schedule-catalog", "yahoo-sports-scoreboard", "yahoo-sports-section-stream", "yahoo-sports-soccer-scoreboard", "yahoo-sports-sportsbook-catalog", "yahoo-sports-standings", "yahoo-sports-stats", "yahoo-sports-stats-catalog", "yahoo-sports-stats-discovery", "yahoo-sports-team", "yahoo-sports-team-roster", "yahoo-sports-team-schedule", "yahoo-sports-tennis-rankings", "yahoo-sports-tennis-schedule", "yahoo-sports-tennis-scoreboard", "yahoo-sports-topic-news", "yahoo-sports-video-headlines", "yahoo-sports-video-list-catalog", "yahoo-sports-watch-schedule"]
|
|
26
|
+
JSON
|
|
27
|
+
OPERATION_COUNT = OPERATION_IDS.length
|
|
28
|
+
|
|
29
|
+
class Client
|
|
30
|
+
attr_reader :base_url
|
|
31
|
+
|
|
32
|
+
def initialize(api_key: ENV["CRAWLORA_API_KEY"], base_url: "https://api.crawlora.net/api/v1", timeout: 30, user_agent: "crawlora-yahoo-sports-ruby/0.1.0", transport: nil)
|
|
33
|
+
@api_key = api_key
|
|
34
|
+
@base_url = base_url.to_s.sub(%r{/+$}, "")
|
|
35
|
+
@timeout = Float(timeout)
|
|
36
|
+
@user_agent = user_agent
|
|
37
|
+
@transport = transport
|
|
38
|
+
@closed = false
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def request(operation_id, params = {}, response_type: :auto)
|
|
42
|
+
raise Errors::ClientError, "client is closed" if @closed
|
|
43
|
+
operation_id = operation_id.to_s
|
|
44
|
+
operation = OPERATIONS[operation_id]
|
|
45
|
+
raise Errors::ClientError.new("unknown operation: #{operation_id}", operation_id: operation_id) unless operation
|
|
46
|
+
raise Errors::ClientError.new("Crawlora API key is required", operation_id: operation_id) if @api_key.nil? || @api_key.to_s.empty?
|
|
47
|
+
normalized = params.each_with_object({}) { |(key, value), out| out[key.to_s] = value }
|
|
48
|
+
payload = request_body(operation, normalized)
|
|
49
|
+
url = build_url(operation, normalized)
|
|
50
|
+
uri = URI.parse(url)
|
|
51
|
+
request = operation["method"] == "POST" ? Net::HTTP::Post.new(uri) : Net::HTTP::Get.new(uri)
|
|
52
|
+
unless payload.nil?
|
|
53
|
+
request.body = payload
|
|
54
|
+
request["Content-Type"] = "application/json"
|
|
55
|
+
end
|
|
56
|
+
request["x-api-key"] = @api_key
|
|
57
|
+
request["User-Agent"] = @user_agent
|
|
58
|
+
request["Accept"] = operation["produces"].include?("text/plain") ? "application/json, text/plain" : "application/json"
|
|
59
|
+
begin
|
|
60
|
+
if @transport
|
|
61
|
+
response = if operation["method"] == "POST"
|
|
62
|
+
@transport.call(url, request.to_hash, @timeout, "POST", payload)
|
|
63
|
+
else
|
|
64
|
+
@transport.call(url, request.to_hash, @timeout)
|
|
65
|
+
end
|
|
66
|
+
status = Integer(response.fetch(:status) { response.fetch("status") })
|
|
67
|
+
body = response.fetch(:body) { response.fetch("body", "") }
|
|
68
|
+
headers = response.fetch(:headers) { response.fetch("headers", {}) }
|
|
69
|
+
content_type = headers["content-type"] || headers["Content-Type"]
|
|
70
|
+
else
|
|
71
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
72
|
+
http.use_ssl = uri.scheme == "https"
|
|
73
|
+
http.open_timeout = @timeout
|
|
74
|
+
http.read_timeout = @timeout
|
|
75
|
+
response = http.start { |connection| connection.request(request) }
|
|
76
|
+
status = response.code.to_i
|
|
77
|
+
body = response.body
|
|
78
|
+
content_type = response["content-type"]
|
|
79
|
+
end
|
|
80
|
+
rescue Timeout::Error, SocketError, SystemCallError, IOError, EOFError, Net::HTTPBadResponse, Net::ProtocolError, OpenSSL::SSL::SSLError => error
|
|
81
|
+
raise Errors::NetworkError.new("Crawlora request failed: #{error.message}", operation_id: operation_id)
|
|
82
|
+
end
|
|
83
|
+
unless status >= 200 && status < 300
|
|
84
|
+
klass = status >= 500 ? Errors::ServerError : Errors::ClientError
|
|
85
|
+
raise klass.new("Crawlora returned HTTP #{status}", status: status, operation_id: operation_id, body: body)
|
|
86
|
+
end
|
|
87
|
+
parse_response(body, content_type, operation, normalized, response_type)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def close
|
|
91
|
+
@closed = true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def closed?
|
|
95
|
+
@closed
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def with
|
|
99
|
+
return self unless block_given?
|
|
100
|
+
yield self
|
|
101
|
+
ensure
|
|
102
|
+
close if block_given?
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def self.operation_count
|
|
106
|
+
OPERATION_COUNT
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def self.operation_ids
|
|
110
|
+
OPERATION_IDS
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def self.operations
|
|
114
|
+
OPERATIONS
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
define_method('college_rankings') do |**params|
|
|
118
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
119
|
+
request('yahoo-sports-college-rankings', params, response_type: response_type)
|
|
120
|
+
end
|
|
121
|
+
define_method('draft') do |**params|
|
|
122
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
123
|
+
request('yahoo-sports-draft', params, response_type: response_type)
|
|
124
|
+
end
|
|
125
|
+
define_method('dropdown_catalog') do |**params|
|
|
126
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
127
|
+
request('yahoo-sports-dropdown-catalog', params, response_type: response_type)
|
|
128
|
+
end
|
|
129
|
+
define_method('game') do |**params|
|
|
130
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
131
|
+
request('yahoo-sports-game', params, response_type: response_type)
|
|
132
|
+
end
|
|
133
|
+
define_method('golf_leaderboard') do |**params|
|
|
134
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
135
|
+
request('yahoo-sports-golf-leaderboard', params, response_type: response_type)
|
|
136
|
+
end
|
|
137
|
+
define_method('golf_player') do |**params|
|
|
138
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
139
|
+
request('yahoo-sports-golf-player', params, response_type: response_type)
|
|
140
|
+
end
|
|
141
|
+
define_method('golf_player_news') do |**params|
|
|
142
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
143
|
+
request('yahoo-sports-golf-player-news', params, response_type: response_type)
|
|
144
|
+
end
|
|
145
|
+
define_method('golf_players') do |**params|
|
|
146
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
147
|
+
request('yahoo-sports-golf-players', params, response_type: response_type)
|
|
148
|
+
end
|
|
149
|
+
define_method('golf_schedule') do |**params|
|
|
150
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
151
|
+
request('yahoo-sports-golf-schedule', params, response_type: response_type)
|
|
152
|
+
end
|
|
153
|
+
define_method('home') do |**params|
|
|
154
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
155
|
+
request('yahoo-sports-home', params, response_type: response_type)
|
|
156
|
+
end
|
|
157
|
+
define_method('injury_report') do |**params|
|
|
158
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
159
|
+
request('yahoo-sports-injury-report', params, response_type: response_type)
|
|
160
|
+
end
|
|
161
|
+
define_method('league_schedule') do |**params|
|
|
162
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
163
|
+
request('yahoo-sports-league-schedule', params, response_type: response_type)
|
|
164
|
+
end
|
|
165
|
+
define_method('leagues') do |**params|
|
|
166
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
167
|
+
request('yahoo-sports-leagues', params, response_type: response_type)
|
|
168
|
+
end
|
|
169
|
+
define_method('mma_fight_card') do |**params|
|
|
170
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
171
|
+
request('yahoo-sports-mma-fight-card', params, response_type: response_type)
|
|
172
|
+
end
|
|
173
|
+
define_method('mma_schedule') do |**params|
|
|
174
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
175
|
+
request('yahoo-sports-mma-schedule', params, response_type: response_type)
|
|
176
|
+
end
|
|
177
|
+
define_method('more_news') do |**params|
|
|
178
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
179
|
+
request('yahoo-sports-more-news', params, response_type: response_type)
|
|
180
|
+
end
|
|
181
|
+
define_method('motorsports_race') do |**params|
|
|
182
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
183
|
+
request('yahoo-sports-motorsports-race', params, response_type: response_type)
|
|
184
|
+
end
|
|
185
|
+
define_method('motorsports_schedule') do |**params|
|
|
186
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
187
|
+
request('yahoo-sports-motorsports-schedule', params, response_type: response_type)
|
|
188
|
+
end
|
|
189
|
+
define_method('navigation') do |**params|
|
|
190
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
191
|
+
request('yahoo-sports-navigation', params, response_type: response_type)
|
|
192
|
+
end
|
|
193
|
+
define_method('network_catalog') do |**params|
|
|
194
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
195
|
+
request('yahoo-sports-network-catalog', params, response_type: response_type)
|
|
196
|
+
end
|
|
197
|
+
define_method('news') do |**params|
|
|
198
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
199
|
+
request('yahoo-sports-news', params, response_type: response_type)
|
|
200
|
+
end
|
|
201
|
+
define_method('newsletter_archive') do |**params|
|
|
202
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
203
|
+
request('yahoo-sports-newsletter-archive', params, response_type: response_type)
|
|
204
|
+
end
|
|
205
|
+
define_method('newsletters') do |**params|
|
|
206
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
207
|
+
request('yahoo-sports-newsletters', params, response_type: response_type)
|
|
208
|
+
end
|
|
209
|
+
define_method('odds_featured') do |**params|
|
|
210
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
211
|
+
request('yahoo-sports-odds-featured', params, response_type: response_type)
|
|
212
|
+
end
|
|
213
|
+
define_method('odds_game') do |**params|
|
|
214
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
215
|
+
request('yahoo-sports-odds-game', params, response_type: response_type)
|
|
216
|
+
end
|
|
217
|
+
define_method('odds_games') do |**params|
|
|
218
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
219
|
+
request('yahoo-sports-odds-games', params, response_type: response_type)
|
|
220
|
+
end
|
|
221
|
+
define_method('odds_trending') do |**params|
|
|
222
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
223
|
+
request('yahoo-sports-odds-trending', params, response_type: response_type)
|
|
224
|
+
end
|
|
225
|
+
define_method('olympics_medals') do |**params|
|
|
226
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
227
|
+
request('yahoo-sports-olympics-medals', params, response_type: response_type)
|
|
228
|
+
end
|
|
229
|
+
define_method('player') do |**params|
|
|
230
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
231
|
+
request('yahoo-sports-player', params, response_type: response_type)
|
|
232
|
+
end
|
|
233
|
+
define_method('player_search') do |**params|
|
|
234
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
235
|
+
request('yahoo-sports-player-search', params, response_type: response_type)
|
|
236
|
+
end
|
|
237
|
+
define_method('playoff_bracket') do |**params|
|
|
238
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
239
|
+
request('yahoo-sports-playoff-bracket', params, response_type: response_type)
|
|
240
|
+
end
|
|
241
|
+
define_method('playoff_bracket_catalog') do |**params|
|
|
242
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
243
|
+
request('yahoo-sports-playoff-bracket-catalog', params, response_type: response_type)
|
|
244
|
+
end
|
|
245
|
+
define_method('rss_catalog') do |**params|
|
|
246
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
247
|
+
request('yahoo-sports-rss-catalog', params, response_type: response_type)
|
|
248
|
+
end
|
|
249
|
+
define_method('rss_feed') do |**params|
|
|
250
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
251
|
+
request('yahoo-sports-rss-feed', params, response_type: response_type)
|
|
252
|
+
end
|
|
253
|
+
define_method('schedule_catalog') do |**params|
|
|
254
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
255
|
+
request('yahoo-sports-schedule-catalog', params, response_type: response_type)
|
|
256
|
+
end
|
|
257
|
+
define_method('scoreboard') do |**params|
|
|
258
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
259
|
+
request('yahoo-sports-scoreboard', params, response_type: response_type)
|
|
260
|
+
end
|
|
261
|
+
define_method('section_stream') do |**params|
|
|
262
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
263
|
+
request('yahoo-sports-section-stream', params, response_type: response_type)
|
|
264
|
+
end
|
|
265
|
+
define_method('soccer_scoreboard') do |**params|
|
|
266
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
267
|
+
request('yahoo-sports-soccer-scoreboard', params, response_type: response_type)
|
|
268
|
+
end
|
|
269
|
+
define_method('sportsbook_catalog') do |**params|
|
|
270
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
271
|
+
request('yahoo-sports-sportsbook-catalog', params, response_type: response_type)
|
|
272
|
+
end
|
|
273
|
+
define_method('standings') do |**params|
|
|
274
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
275
|
+
request('yahoo-sports-standings', params, response_type: response_type)
|
|
276
|
+
end
|
|
277
|
+
define_method('stats') do |**params|
|
|
278
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
279
|
+
request('yahoo-sports-stats', params, response_type: response_type)
|
|
280
|
+
end
|
|
281
|
+
define_method('stats_catalog') do |**params|
|
|
282
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
283
|
+
request('yahoo-sports-stats-catalog', params, response_type: response_type)
|
|
284
|
+
end
|
|
285
|
+
define_method('stats_discovery') do |**params|
|
|
286
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
287
|
+
request('yahoo-sports-stats-discovery', params, response_type: response_type)
|
|
288
|
+
end
|
|
289
|
+
define_method('team') do |**params|
|
|
290
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
291
|
+
request('yahoo-sports-team', params, response_type: response_type)
|
|
292
|
+
end
|
|
293
|
+
define_method('team_roster') do |**params|
|
|
294
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
295
|
+
request('yahoo-sports-team-roster', params, response_type: response_type)
|
|
296
|
+
end
|
|
297
|
+
define_method('team_schedule') do |**params|
|
|
298
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
299
|
+
request('yahoo-sports-team-schedule', params, response_type: response_type)
|
|
300
|
+
end
|
|
301
|
+
define_method('tennis_rankings') do |**params|
|
|
302
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
303
|
+
request('yahoo-sports-tennis-rankings', params, response_type: response_type)
|
|
304
|
+
end
|
|
305
|
+
define_method('tennis_schedule') do |**params|
|
|
306
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
307
|
+
request('yahoo-sports-tennis-schedule', params, response_type: response_type)
|
|
308
|
+
end
|
|
309
|
+
define_method('tennis_scoreboard') do |**params|
|
|
310
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
311
|
+
request('yahoo-sports-tennis-scoreboard', params, response_type: response_type)
|
|
312
|
+
end
|
|
313
|
+
define_method('topic_news') do |**params|
|
|
314
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
315
|
+
request('yahoo-sports-topic-news', params, response_type: response_type)
|
|
316
|
+
end
|
|
317
|
+
define_method('video_headlines') do |**params|
|
|
318
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
319
|
+
request('yahoo-sports-video-headlines', params, response_type: response_type)
|
|
320
|
+
end
|
|
321
|
+
define_method('video_list_catalog') do |**params|
|
|
322
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
323
|
+
request('yahoo-sports-video-list-catalog', params, response_type: response_type)
|
|
324
|
+
end
|
|
325
|
+
define_method('watch_schedule') do |**params|
|
|
326
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
327
|
+
request('yahoo-sports-watch-schedule', params, response_type: response_type)
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
private
|
|
331
|
+
|
|
332
|
+
# POST operations take their JSON body under the body parameter name or "body".
|
|
333
|
+
def request_body(operation, params)
|
|
334
|
+
name = operation["bodyParam"]
|
|
335
|
+
return nil if name.nil?
|
|
336
|
+
value = params.key?(name) ? params[name] : params["body"]
|
|
337
|
+
if value.nil?
|
|
338
|
+
raise Errors::ClientError.new("missing request body: #{name}", operation_id: operation["id"]) if operation["bodyRequired"]
|
|
339
|
+
return nil
|
|
340
|
+
end
|
|
341
|
+
value.is_a?(String) ? value : JSON.generate(value)
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def build_url(operation, params)
|
|
345
|
+
known = operation["params"].map { |param| param["name"] }
|
|
346
|
+
known << "body" if operation["bodyParam"]
|
|
347
|
+
unknown = params.keys - known
|
|
348
|
+
raise Errors::ClientError.new("unknown parameters: #{unknown.join(', ')}", operation_id: operation["id"]) unless unknown.empty?
|
|
349
|
+
path = operation["path"].dup
|
|
350
|
+
operation["params"].select { |param| param["in"] == "path" }.each do |param|
|
|
351
|
+
value = params[param["name"]]
|
|
352
|
+
raise Errors::ClientError.new("missing path parameter: #{param['name']}", operation_id: operation["id"]) if value.nil?
|
|
353
|
+
path.sub!("{" + param["name"] + "}", percent_encode(value.to_s))
|
|
354
|
+
end
|
|
355
|
+
pairs = []
|
|
356
|
+
operation["queryParams"].each do |param|
|
|
357
|
+
name = param["name"]
|
|
358
|
+
value = params.key?(name) ? params[name] : param["default"]
|
|
359
|
+
if value.nil?
|
|
360
|
+
raise Errors::ClientError.new("missing query parameter: #{name}", operation_id: operation["id"]) if param["required"]
|
|
361
|
+
next
|
|
362
|
+
end
|
|
363
|
+
enum_values = param["enum"] || (param["items"] && param["items"]["enum"])
|
|
364
|
+
if enum_values && !(value.is_a?(Array) ? value : [value]).all? { |item| enum_values.map(&:to_s).include?(item.to_s) }
|
|
365
|
+
raise Errors::ClientError.new("invalid value for #{name}", operation_id: operation["id"])
|
|
366
|
+
end
|
|
367
|
+
if value.is_a?(Array)
|
|
368
|
+
format = param["collectionFormat"] || "csv"
|
|
369
|
+
if format == "multi"
|
|
370
|
+
value.each { |item| pairs << [name, scalar(item)] }
|
|
371
|
+
else
|
|
372
|
+
separator = {"csv" => ",", "ssv" => " ", "tsv" => "\t", "pipes" => "|"}[format] || ","
|
|
373
|
+
pairs << [name, value.map { |item| scalar(item) }.join(separator)]
|
|
374
|
+
end
|
|
375
|
+
else
|
|
376
|
+
pairs << [name, scalar(value)]
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
query = pairs.map { |name, value| "#{percent_encode(name)}=#{percent_encode(value)}" }.join("&")
|
|
380
|
+
@base_url + path + (query.empty? ? "" : "?" + query)
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
def scalar(value)
|
|
384
|
+
value == true ? "true" : (value == false ? "false" : value.to_s)
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def percent_encode(value)
|
|
388
|
+
URI::DEFAULT_PARSER.escape(value.to_s, /[^A-Za-z0-9\-._~]/)
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def parse_response(body, content_type, operation, params, response_type)
|
|
392
|
+
type = response_type.to_s
|
|
393
|
+
raise Errors::ClientError.new("response_type must be auto, json, or text", operation_id: operation["id"]) unless %w[auto json text].include?(type)
|
|
394
|
+
format = operation["params"].find { |param| param["name"] == "format" }
|
|
395
|
+
text_formats = format && format["enum"] ? format["enum"].reject { |value| %w[json application/json].include?(value.to_s.downcase) } : []
|
|
396
|
+
raw_format = params["format"] && text_formats.include?(params["format"].to_s)
|
|
397
|
+
json_format = format && format["enum"] && format["enum"].any? { |value| %w[json application/json].include?(value.to_s.downcase) } && %w[json application/json].include?(params["format"].to_s.downcase)
|
|
398
|
+
is_json = json_format || content_type.to_s.downcase.include?("json") || operation["produces"] == ["application/json"]
|
|
399
|
+
return body if type == "text" || raw_format || (type == "auto" && !is_json)
|
|
400
|
+
JSON.parse(body)
|
|
401
|
+
rescue JSON::ParserError => error
|
|
402
|
+
raise Errors::Error.new("invalid JSON response from Crawlora: #{error.message}", operation_id: operation["id"], body: body)
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
public
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: crawlora-yahoo-sports
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Crawlora
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Ruby client for Crawlora's hosted Yahoo Sports API. Covers league, team,
|
|
14
|
+
player, game, schedule, standings, rankings, and fantasy sports data across 53 endpoints.
|
|
15
|
+
email:
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- CHANGELOG.md
|
|
21
|
+
- LICENSE
|
|
22
|
+
- README.md
|
|
23
|
+
- lib/crawlora/yahoo-sports.rb
|
|
24
|
+
- lib/crawlora/yahoo-sports/client.rb
|
|
25
|
+
- lib/crawlora/yahoo-sports/version.rb
|
|
26
|
+
homepage: https://crawlora.net/?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=yahoo-sports-ruby-homepage
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
metadata:
|
|
30
|
+
source_code_uri: https://github.com/Crawlora-org/crawlora-yahoo-sports
|
|
31
|
+
documentation_uri: https://github.com/Crawlora-org/crawlora-yahoo-sports/blob/main/ruby/README.md
|
|
32
|
+
rubygems_mfa_required: 'true'
|
|
33
|
+
post_install_message:
|
|
34
|
+
rdoc_options: []
|
|
35
|
+
require_paths:
|
|
36
|
+
- lib
|
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '2.6'
|
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
requirements: []
|
|
48
|
+
rubygems_version: 3.4.19
|
|
49
|
+
signing_key:
|
|
50
|
+
specification_version: 4
|
|
51
|
+
summary: Yahoo Sports API client for Crawlora (53 endpoints)
|
|
52
|
+
test_files: []
|