From 6e65dcaa59eba71ca760837636816aab8c621b41 Mon Sep 17 00:00:00 2001 From: Hofei Date: Mon, 15 Feb 2021 23:43:26 +0100 Subject: [PATCH] change User-Agent --- get_cod_stats.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/get_cod_stats.py b/get_cod_stats.py index 8287172..d5d5de6 100644 --- a/get_cod_stats.py +++ b/get_cod_stats.py @@ -41,7 +41,8 @@ def check_user(user): def get_game_mode_stats_raw(user): url = "https://cod.tracker.gg/modern-warfare/profile/battlenet/{}/mp/modes".format(user) - source = requests.get(url).text + source = requests.get(url, headers={"User-Agent": "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:82.0) " + "Gecko/20100101 Firefox/82.0"}).text soup = BeautifulSoup(source, features="html5lib") scripts = [script.string for script in soup.find_all("script") if script.string] initial_state_script = None