aboutsummaryrefslogtreecommitdiff
path: root/data/fetch-genesys.py
blob: 2c92ddd80dcfb9fd4b1df48c16830b2f1af98fe5 (plain)
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
import re
from urllib.request import urlopen

url = "https://www.yugioh-card.com/en/genesys/"
html = urlopen(url).read().decode("utf-8")

inside = False
rows = []

for line in html.splitlines():
    if '<td class="column-1">' in line:
        pattern = r'lass="column-1">([^<>]+?)</td>'
        match = re.search(pattern, line)
        if match:
            print(match.group(1).strip())
        else:
            raise RuntimeError("error")
        pattern = r'lass="column-2">([^<>]+?)$'
        match = re.search(pattern, line)
        if match:
            print(match.group(1).strip())
        else:
            raise RuntimeError("error")