File size: 2,599 Bytes
e84f53b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be4752e
e84f53b
 
be4752e
 
e84f53b
 
 
 
 
be4752e
 
 
 
 
 
 
 
e84f53b
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import sqlite3
import re
import yaml

def generate_readme():
    conn = sqlite3.connect('state.db')
    cursor = conn.cursor()
    cursor.execute('SELECT site, COUNT(*) FROM pages GROUP BY site ORDER BY COUNT(*) DESC')
    stats = cursor.fetchall()
    conn.close()

    with open('sites.yaml') as f:
        content = f.read()
    
    # Extract site and url pairs, including from commented lines
    # Matches: site: name, url: "domain.com"
    url_map = dict(re.findall(r'site:\s*(\w+),\s*url:\s*\"([^\"]+)\"', content))

    total_links = sum(count for _, count in stats)
    
    table_rows = []
    for site, count in stats:
        url = url_map.get(site, "N/A")
        table_rows.append(f"| {site} | {url} | {count:,} |")

    table_content = "\n".join(table_rows)

    readme_template = f"""---

license: odc-by

task_categories:

- text-retrieval

language:

- en

tags:

- mtg

- magic-the-gathering

- web-archive

---



# mtg-links



This dataset contains {total_links:,} URLs pointing to Magic: The Gathering (MTG) content. These links come from the Internet Archive's Wayback Machine. They cover major MTG community sites, strategy blogs, and official news outlets.



This dataset is the index for a project to build a complete text corpus of Magic: The Gathering strategy, lore, and history.



## Content breakdown



| Site | Domain | Link Count |

| :--- | :--- | :--- |

{table_content}



## Dataset structure



The dataset is a single CSV file, `links.csv`, with the following columns:



- `url`: The full URL found in the Internet Archive CDX index.

- `site`: The identifier for the source website (e.g., `mtggoldfish`, `edhrec_articles`).

- `http_code`: The HTTP status code returned by the Wayback Machine for that URL.



## Collection method



URLs were pulled using the Internet Archive CDX API. The crawler targeted specific domains known to host Magic: The Gathering content, searching for all unique URLs indexed by the Wayback Machine.



This specific snapshot covers URLs indexed between **2025 and 2026**.



To replicate the discovery process, use the provided `fetch.py` script:



```bash

python fetch.py discover --from-year 2025 --to-year 2026

```



## License



The list of URLs is provided under the Open Data Commons Attribution License (ODC-By). You must follow the terms of service and robots.txt of the source websites if you use these links to download content.

"""
    with open('README.md', 'w', encoding='utf-8') as f:
        f.write(readme_template)

if __name__ == "__main__":
    generate_readme()