mtg-playerinfo 1.0.1 → 1.0.2

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.
package/README.md CHANGED
@@ -1,17 +1,26 @@
1
1
  # MTG Player Info
2
2
 
3
+ ![GitHub stars](https://img.shields.io/github/stars/bkimminich/mtg-playerinfo.svg?label=GitHub%20%E2%98%85&style=flat)
4
+ ![node](https://img.shields.io/node/v/mtg-playerinfo.svg) [![npm](https://img.shields.io/npm/dm/mtg-playerinfo.svg)](https://www.npmjs.com/package/mtg-playerinfo) [![npm](https://img.shields.io/npm/dt/mtg-playerinfo.svg)](https://www.npmjs.com/package/mtg-playerinfo)
5
+
3
6
  A simple NPM module and CLI tool to pull Magic: The Gathering player data from various sources (Unity League, MTG Elo Project, Melee, and Topdeck).
4
7
 
5
8
  ## Installation
6
9
 
7
10
  ```bash
8
- npm install
11
+ npm i -g mtg-player-info
9
12
  ```
10
13
 
11
14
  ## CLI Usage
12
15
 
13
16
  ```bash
14
- node cli.js --unity-id 16215 --mtgelo-id 3irvwtmk --melee-user k0shiii --topdeck-handle k0shiii
17
+ mtg-player-info --unity-id 16215 --mtgelo-id 3irvwtmk --melee-user k0shiii --topdeck-handle k0shiii
18
+ ```
19
+
20
+ or without previous installation
21
+
22
+ ```bash
23
+ npx mtg-player-info --unity-id 16215 --mtgelo-id 3irvwtmk --melee-user k0shiii --topdeck-handle k0shiii
15
24
  ```
16
25
 
17
26
  ## Output Format
@@ -19,11 +28,13 @@ node cli.js --unity-id 16215 --mtgelo-id 3irvwtmk --melee-user k0shiii --topdeck
19
28
  The tool returns a JSON object representing the player and their combined metadata. Redundant information like Name, Photo, Country, Age, and Hometown is merged into a `general` section, while source-specific data is kept in the `sources` section.
20
29
 
21
30
  ### Deduplication and Merging Logic
22
- - **Priority**: Merging follows a "first-come, first-served" approach based on the order of sources provided in the command line or processed by the manager. For instance, the first valid `photo` URL found will be used as the primary photo for the player profile.
31
+
32
+ - **Priority**: Merging follows a "first-come, first-served" approach based on the order of sources provided in the command line or processed by the manager. For instance, the first `name` and first valid `photo` URL found will be used as the primary name and photo for the player.
23
33
  - **Deduplication**: If multiple IDs point to the exact same profile URL, the profile is only processed once to avoid redundant data in the `sources` section.
24
34
  - **General Metadata**: Fields like `Age`, `Country`, and `Hometown` are extracted from the first source that provides them and placed in the `general` section.
25
35
 
26
36
  Example output:
37
+
27
38
  ```json
28
39
  {
29
40
  "name": "Björn Kimminich",
@@ -42,7 +53,7 @@ Example output:
42
53
  "data": {
43
54
  "Local organizer": "Mulligan TCG Shop",
44
55
  "Rank Germany": "58",
45
- "Rank Europe": "578",
56
+ "Rank Europe": "584",
46
57
  "Rank Points": "274",
47
58
  "Record": "38-38-5",
48
59
  "Win Rate": "49.0%"
@@ -59,14 +70,11 @@ Example output:
59
70
  },
60
71
  "Melee": {
61
72
  "url": "https://melee.gg/Profile/Index/k0shiii",
62
- "data": {
63
- "username": "k0shiii"
64
- }
73
+ "data": {}
65
74
  },
66
75
  "Topdeck": {
67
76
  "url": "https://topdeck.gg/profile/@k0shiii",
68
77
  "data": {
69
- "handle": "@k0shiii",
70
78
  "Tournaments": "2",
71
79
  "Record": "4-6-1",
72
80
  "Win Rate": "36.36%",
@@ -79,11 +87,26 @@ Example output:
79
87
 
80
88
  ## Supported Sources
81
89
 
82
- | Site | Method |
83
- |-----------------|----------|
84
- | Unity League | Scraping |
85
- | MTG Elo Project | Scraping |
86
- | Melee | Scraping |
87
- | Topdeck | Scraping |
90
+ The following sites are currently supported based on HTML scraping and/or API calls. In general, API calls are preferred over scraping due to their higher reliability and independence from site structure changes.
91
+
92
+ | Site | Method |
93
+ |-----------------|------------------------|
94
+ | Unity League | Scraping |
95
+ | MTG Elo Project | Scraping |
96
+ | Topdeck | ✅Scraping |
97
+ | Melee | ✅Scraping / 🚧API (#1) |
98
+
99
+ _Note: Some sites may have anti-bot protections that can lead to "Maximum number of redirects exceeded" or "403 Forbidden" errors depending on the execution environment._
100
+
101
+ ## Contribution Guidelines
102
+
103
+ 1. All PRs _should_ have a dedicated scope (e.g. not mixing code refactorings with delivering a new feature) and reasonable size.
104
+ 2. Noise (e.g. unnecessary comments) generated by AI tools _must_ be removed before opening a PR.
105
+ 3. All Git commits within a PR _must_ be [signed off](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--s) to indicate the contributor's agreement with the [Developer Certificate of Origin](https://developercertificate.org/).
106
+ 4. Particularly low-effort contributions (e.g. incomplete typo fixes in a single file, trivial text changes, code formatting) or any forms of potential "contribution farming" _must not_ be submitted as PRs.
107
+
108
+ ## Licensing
109
+
110
+ [![license](https://img.shields.io/github/license/juice-shop/juice-shop.svg)](LICENSE)
88
111
 
89
- Note: Some sites may have anti-bot protections that can lead to "Maximum number of redirects exceeded" or "403 Forbidden" errors depending on the execution environment.
112
+ This program is free software: you can redistribute it and/or modify it under the terms of the [MIT license](LICENSE). MTG Player Info and any contributions are Copyright © by Bjoern Kimminich 2026.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtg-playerinfo",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A simple NPM module and CLI tool to pull Magic: The Gathering player data from various sources",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -15,5 +15,8 @@
15
15
  "dependencies": {
16
16
  "cheerio": "^1.2.0",
17
17
  "commander": "^14.0.3"
18
+ },
19
+ "engines": {
20
+ "node": "20 - 24"
18
21
  }
19
22
  }
@@ -23,9 +23,7 @@ class MeleeFetcher {
23
23
  url,
24
24
  name,
25
25
  photo: photo ? (photo.startsWith('http') ? photo : `https://melee.gg${photo}`) : null,
26
- details: {
27
- username
28
- }
26
+ details: { }
29
27
  };
30
28
 
31
29
  return data;
@@ -70,9 +70,7 @@ class TopdeckFetcher {
70
70
  url,
71
71
  name,
72
72
  photo: photo ? (photo.startsWith('http') ? photo : `https://topdeck.gg${photo}`) : null,
73
- details: {
74
- handle
75
- }
73
+ details: { }
76
74
  };
77
75
 
78
76
  const statsMap = {