From 5e28e421f5fbb7c5b9bbe0ddbf9daf7004b1037f Mon Sep 17 00:00:00 2001 From: devo1ution Date: Mon, 26 Feb 2024 21:47:17 -0800 Subject: [PATCH 1/2] update script to https --- .../markdown/ProblemsList/DivisionList/scripts/update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/markdown/ProblemsList/DivisionList/scripts/update.py b/src/components/markdown/ProblemsList/DivisionList/scripts/update.py index 6c2433023c..a3e2b2626d 100644 --- a/src/components/markdown/ProblemsList/DivisionList/scripts/update.py +++ b/src/components/markdown/ProblemsList/DivisionList/scripts/update.py @@ -7,8 +7,8 @@ from bs4 import BeautifulSoup from loguru import logger -INDEX_PREFIX = "http://www.usaco.org/index.php?page=" -DATA_PREFIX = "http://www.usaco.org/current/data/" +INDEX_PREFIX = "https://www.usaco.org/index.php?page=" +DATA_PREFIX = "https://www.usaco.org/current/data/" DIVISIONS = ["Bronze", "Silver", "Gold", "Platinum"] CONTESTS_SHORT = ["dec", "jan", "feb", "open"] CONTESTS_LONG = ["December", "January", "February", "US Open"] From 5d7f5ad110a425aab9b01f33ae3d9f1bf3530fd4 Mon Sep 17 00:00:00 2001 From: devo1ution Date: Wed, 28 Feb 2024 13:46:49 -0800 Subject: [PATCH 2/2] fix --- .../markdown/ProblemsList/DivisionList/scripts/update.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/markdown/ProblemsList/DivisionList/scripts/update.py b/src/components/markdown/ProblemsList/DivisionList/scripts/update.py index a3e2b2626d..372af9ea75 100644 --- a/src/components/markdown/ProblemsList/DivisionList/scripts/update.py +++ b/src/components/markdown/ProblemsList/DivisionList/scripts/update.py @@ -1,6 +1,6 @@ import argparse import json -import urllib.request +import urllib.request, ssl import os from typing import Iterable, Optional, Tuple @@ -16,7 +16,8 @@ def parse(url: str) -> BeautifulSoup: - page = urllib.request.urlopen(url) + req = urllib.request.Request(url, headers={"User-Agent": "Magic Browser"}) + page = urllib.request.urlopen(req) return BeautifulSoup(page, "html.parser")