diff options
author | rubenwardy <rw@rubenwardy.com> | 2019-07-29 23:31:42 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-07-29 23:31:42 +0100 |
commit | 1da86f27a7d92e0659b9fc1ae0aa530ebe9a8fd4 (patch) | |
tree | b9631e78b2d380536b0fc5119bf1ccd3e71a0815 /app/tasks | |
parent | 85340a2fe91fa68f259876fbdb478351519cdcf4 (diff) | |
download | cheatdb-1da86f27a7d92e0659b9fc1ae0aa530ebe9a8fd4.tar.xz |
Fix topic ID parse error in import topics taskv1.16.1
Diffstat (limited to 'app/tasks')
-rw-r--r-- | app/tasks/forumtasks.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/app/tasks/forumtasks.py b/app/tasks/forumtasks.py index 85d4b09..9b200fc 100644 --- a/app/tasks/forumtasks.py +++ b/app/tasks/forumtasks.py @@ -99,11 +99,19 @@ def parseTitle(title): def getLinksFromModSearch(): links = {} - contents = urllib.request.urlopen("https://krock-works.uk.to/minetest/modList.php").read().decode("utf-8") - for x in json.loads(contents): - link = x.get("link") - if link is not None: - links[int(x["topicId"])] = link + try: + contents = urllib.request.urlopen("https://krock-works.uk.to/minetest/modList.php").read().decode("utf-8") + for x in json.loads(contents): + try: + link = x.get("link") + if link is not None: + links[int(x["topicId"])] = link + except ValueError: + pass + + except urllib.error.URLError: + print("Unable to open krocks mod search!") + return links return links |