Script to fetch unrealircd releases (#4)

unrealircd: 6.0.3
elasticsearch: 8.2.0
laravel: 8.83.11, 9.11.0
This commit is contained in:
Nemo
2022-05-03 21:53:53 +05:30
committed by GitHub
parent 7dd09864e5
commit 8997487f42
7 changed files with 115 additions and 3 deletions

24
src/unrealircd.py Normal file
View File

@@ -0,0 +1,24 @@
import mwparserfromhell
import json
import re
import urllib.request
URL = "https://www.unrealircd.org/docwiki/index.php?title=History_of_UnrealIRCd_releases&action=raw"
REGEX = r'^(?:(\d+\.(?:\d+\.)*\d+))$'
list = {}
with urllib.request.urlopen(URL) as response:
text = response.read()
wikicode = mwparserfromhell.parse(text)
for tr in wikicode.ifilter_tags(matches=lambda node: node.tag == "tr"):
items = tr.contents.filter_tags(matches=lambda node: node.tag == "td")
if len(items) >=2:
maybe_version = items[0].__strip__()
if re.match(REGEX, maybe_version):
maybe_date = items[1].__strip__()
if re.match(r'\d{4}-\d{2}-\d{2}', maybe_date):
list[maybe_version] = maybe_date
with open('releases/custom/unrealircd.json', 'w') as f:
f.write(json.dumps(list, indent=2))