Created
February 15, 2026 18:04
-
-
Save cmj/1df8e91bdd3b12a1f55091a04fbcf990 to your computer and use it in GitHub Desktop.
Downdetector - new site update (2026-02)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import cloudscraper | |
| from bs4 import BeautifulSoup | |
| URL = "https://downdetector.com" | |
| MAX_SITES = 15 | |
| def create_scraper(): | |
| return cloudscraper.create_scraper( | |
| interpreter="js2py", | |
| delay=5, | |
| enable_stealth=True, | |
| stealth_options={ | |
| "min_delay": 2.0, | |
| "max_delay": 6.0, | |
| "human_like_delays": True, | |
| "randomize_headers": True, | |
| "browser_quirks": True, | |
| }, | |
| ) | |
| def fetch_page(scraper, url): | |
| try: | |
| response = scraper.get(url, timeout=15) | |
| response.raise_for_status() | |
| return response.content | |
| except Exception as e: | |
| sys.exit(f"Error fetching {url}: {e}") | |
| def parse_sites(html): | |
| soup = BeautifulSoup(html, "html.parser") | |
| container = soup.find(class_="contents") | |
| if not container: | |
| return [] | |
| sites = container.find_all("div", class_="py-2") | |
| names = [] | |
| for site in sites[:MAX_SITES]: | |
| header = site.find("h2") | |
| if header: | |
| names.append(header.get_text(strip=True)) | |
| return names | |
| def main(): | |
| scraper = create_scraper() | |
| html = fetch_page(scraper, URL) | |
| site_names = parse_sites(html) | |
| print(" • ".join(site_names)) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment