Update website link script
Some checks failed
/ lint (push) Failing after 1m8s

This commit is contained in:
Jake Howard 2023-07-28 14:54:01 +01:00
parent a1d1c2f96e
commit fc557f00d3
Signed by: jake
GPG Key ID: 57AFB45680EDD477

View File

@ -3,19 +3,17 @@
import json import json
import subprocess import subprocess
import urllib.request import urllib.request
import operator
from collections import OrderedDict from collections import OrderedDict
URL = "https://theorangeone.net/index.json" URL = "https://theorangeone.net/api/page-links/?format=json"
def main(): def main():
with urllib.request.urlopen(URL) as response: with urllib.request.urlopen(URL) as response:
data = json.load(response) data = json.load(response)
data = sorted(data, key=operator.itemgetter("date"), reverse=True)
url_mapping = OrderedDict([ url_mapping = OrderedDict([
(d['title'], d['url']) (d['title'], d['full_url'])
for d in data for d in data
]) ])