diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-08-21 13:38:23 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-08-21 13:38:23 -0700 |
| commit | 179c4f6880df1af19f025da7aee3f2a81b95a0fe (patch) | |
| tree | 5413a4654b2ba0b626d5cbe0f7b536360723fa54 /twitch.py | |
| parent | 44c1eddd338a059f0451bffd06215299a8986894 (diff) | |
skip twitch count scrape if request fails for any reason
Diffstat (limited to 'twitch.py')
| -rw-r--r-- | twitch.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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"): |
