pfr-player-data 1.0.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.
Files changed (3) hide show
  1. package/README.md +65 -0
  2. package/index.js +5 -0
  3. package/package.json +16 -0
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # pfr-player-data
2
+
3
+ Fetch NFL player data from [Pro Football Reference](https://www.pro-football-reference.com/) as structured JSON. This package scrapes a player’s PFR page and returns all available stats and info in a single JSON object.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install pfr-player-data
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ const { getPlayerData } = require('pfr-player-data');
15
+
16
+ // By player URL (e.g. https://www.pro-football-reference.com/players/B/BradTo00.htm)
17
+ const data = await getPlayerData('https://www.pro-football-reference.com/players/B/BradTo00.htm');
18
+
19
+ // Or by player identifier (e.g. PFR URL slug: BradTo00)
20
+ const data = await getPlayerData('BradTo00');
21
+ ```
22
+
23
+ ## API
24
+
25
+ ### `getPlayerData(input: string): Promise<Object>`
26
+
27
+ - **`input`** — Either a full Pro Football Reference player URL or the player’s PFR identifier (e.g. `BradTo00`).
28
+ - **Returns** — A Promise that resolves to a JSON object with all available player data from the page.
29
+
30
+ ## Example output
31
+
32
+ The returned object includes (when present on the page):
33
+
34
+ - **Bio** — Name, position, team(s), birth date, college, draft info, etc.
35
+ - **Career stats** — Passing, rushing, receiving, defense, kicking, etc., by season and/or career totals.
36
+ - **Game logs** — Per-game stats when available.
37
+ - **Awards & honors** — Pro Bowls, All-Pro, other recognitions.
38
+ - **Other tables** — Any additional tables on the player’s page (e.g. splits, advanced metrics).
39
+
40
+ Structure is normalized to a consistent JSON shape so you can use it in apps, scripts, or other services without parsing HTML.
41
+
42
+ ## Example
43
+
44
+ ```javascript
45
+ const { getPlayerData } = require('pfr-player-data');
46
+
47
+ async function main() {
48
+ const player = await getPlayerData('BradTo00');
49
+ console.log(player.bio?.name); // e.g. "Tom Brady"
50
+ console.log(player.careerStats); // season-by-season and career totals
51
+ console.log(player.gameLogs); // array of game log entries
52
+ }
53
+
54
+ main().catch(console.error);
55
+ ```
56
+
57
+ ## Notes
58
+
59
+ - **Pro Football Reference**: This package is not affiliated with Sports Reference LLC or Pro Football Reference. Data is scraped from their public site.
60
+ - **Rate limiting**: Be respectful with request frequency (e.g. add delays or caching) to avoid overloading their servers.
61
+ - **Terms of use**: Check [Pro Football Reference’s terms of use](https://www.sports-reference.com/termsofuse.html) before heavy or commercial use.
62
+
63
+ ## License
64
+
65
+ ISC
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export function hello() {
2
+ return "hello world";
3
+ }
4
+
5
+ module.exports = { hello };
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "pfr-player-data",
3
+ "version": "1.0.0",
4
+ "description": "Fetch NFL player data from Pro Football Reference as JSON. Scrapes a player's PFR page and returns all available stats and info.",
5
+ "main": "index.js",
6
+ "files": [
7
+ "dist",
8
+ "index.js"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "keywords": ["nfl", "pro-football-reference", "pfr", "scraper", "player-stats", "football", "sports-reference"],
14
+ "author": "",
15
+ "license": "ISC"
16
+ }