Repository navigation
Fix stackoverflow.com main page retrieval failing on Cloudflare challenge - #442
Merged
benoit74 merged 3 commits intoOct 22, 2026
Merged
Conversation
…enge The homepage of stackoverflow.com redirects to /questions, which is behind a Cloudflare bot challenge. Retry on /help in that case, which carries the same site-wide title/header/CSS/favicon/mathjax/highlight information. The homepage is still tried first since /help redirects to the parent site on meta.* domains. Fixes #441
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #442 +/- ##
=======================================
Coverage 16.62% 16.62%
=======================================
Files 26 26
Lines 2460 2460
Branches 318 318
=======================================
Hits 409 409
Misses 2025 2025
Partials 26 26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The homepage-first/help-fallback split was guarding against meta.* domains, which sotoki doesn't scrape in practice. Always using /help is simpler and just as safe.
benoit74
deleted the
benoit74/stackoverflow.com-is-failing-on-main-page-retrie
branch
October 22, 2026 15:49
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stackoverflow.com's homepage redirects to/questions, which is behind a Cloudflare bot challenge, causing_get_site_details()to fail and the whole scrape with it (stackoverflow.com is failing on main page retrieval #441)._get_site_details()now fetches/helpinstead of the homepage — it isn't guarded and carries the same site-wide title/header/CSS/favicon/mathjax/highlight information on every domain tested.site_titleis now read from the page-independent<meta property="og:site_name">tag instead of<title>, which is more robust (page-dependent<title>would otherwise give odd results, e.g. "Newest Questions - Stack Overflow" instead of "Stack Overflow").