Use StackExchange API as default search backend#518
Open
Conversation
Google, Bing, and DuckDuckGo all now block HTTP scraping with CAPTCHA/consent pages, making howdoi unable to find answers (fixes #516). Switch to StackExchange API as the default search backend (300 free requests/day, no auth needed). The scraping backends remain available as fallbacks via HOWDOI_SEARCH_ENGINE env var. Also: updated user agents to 2024-era browsers, added consent page detection to block indicators, and made empty results trigger engine fallback instead of silently returning nothing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Python 3.7 and 3.8 are no longer available on GitHub Actions runners. Update checkout to v4 and setup-python to v5. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Break long USER_AGENTS lines and suppress E231/E713 false positives from f-string colons and string literals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pylint 2.15.10 crashes on Python 3.12+ with `visit_typealias` error in astroid. Upgrade to pylint 3.3.6 and flake8 7.1.2. Also fix deprecated pylintrc option and exclude setup.py from pylint (distutils removed in 3.12+). Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
- Change default search engine from 'google' to 'stackexchange' in howdoi() and _get_answers() to match _get_links() default - Add force_terminal=True to Rich Console so ANSI color codes are always emitted when -c flag is used (fixes test_colorize) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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
/2.3/search/advanced) as the default search backend, replacing web scraping which is now blocked by Google, Bing, and DuckDuckGoFixes #516. Also addresses #492 and #489 which have the same root cause (search engines blocking HTTP scraping).
Details
The core issue: all three supported search engines (Google, Bing, DuckDuckGo) now actively block the HTTP scraping that howdoi relies on. The StackExchange API provides 300 requests/day without authentication, which is more than sufficient for typical usage.
The
HOWDOI_SEARCH_ENGINEenv var still works — set it togoogle,bing, orduckduckgoto use scraping if preferred. Default is nowstackexchange.Test plan
howdoi print stack trace pythonreturns resultshowdoi format date bashreturns resultshowdoi convert json to csv pythonreturns resultsHOWDOI_SEARCH_ENGINE=googlefallback still works where Google isn't blocking🤖 Generated with Claude Code