summaryrefslogtreecommitdiffstats
path: root/twitch.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-08-21 13:38:23 -0700
committerPinapelz <yukais@pinapelz.com>2025-08-21 13:38:23 -0700
commit179c4f6880df1af19f025da7aee3f2a81b95a0fe (patch)
tree5413a4654b2ba0b626d5cbe0f7b536360723fa54 /twitch.py
parent44c1eddd338a059f0451bffd06215299a8986894 (diff)
skip twitch count scrape if request fails for any reason
Diffstat (limited to 'twitch.py')
-rw-r--r--twitch.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/twitch.py b/twitch.py
index 9ede9bb..bfce676 100644
--- a/twitch.py
+++ b/twitch.py
@@ -50,10 +50,12 @@ def get_total_follower_count_scrape(username: str) -> int:
"Chrome/124.0.0.0 Safari/537.36"
)
}
-
- response = requests.get(url, headers=headers, timeout=10)
- response.raise_for_status()
- html = response.text
+ try:
+ response = requests.get(url, headers=headers, timeout=10)
+ response.raise_for_status()
+ html = response.text
+ except:
+ return None
soup = BeautifulSoup(html, 'html.parser')
for li in soup.find_all("li", class_="list-group-item"):
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage