[Thesaurus] Request failed with status code 403
Extension
https://www.raycast.com/ABukSwienty/thesaurus
Raycast Version
1.104.19
OS Version
26.5.1
Description
Any attempted search returns the same message, as per the title
Steps To Reproduce
Simply fire the Thesaurus extension and try to search any word
Current Behaviour
No response
Expected Behaviour
No response
Thank you for opening this issue!
đź”” @ABukSwienty @YourMCGeek @mbuvarp you might want to have a look.
đź’ˇ Author and Contributors commands
The author and contributors of ABukSwienty/thesaurus can trigger bot actions by commenting:
@raycastbot close this issueCloses the issue.@raycastbot close as not plannedCloses the issue as not planned.@raycastbot close as duplicateCloses the issue as duplicate.@raycastbot rename this issue to "Awesome new title"Renames the issue.@raycastbot reopen this issueReopens the issue.@raycastbot assign meAssigns yourself to the issue.@raycastbot good first issueAdds the "Good first issue" label to the issue.@raycastbot keep this issue openMake sure the issue won't go stale and will be kept open by the bot.
Thanks. I will take a look!
Merriam-Webster has tightened their bot detection and is now blocking all programmatic requests, even with browser-spoofed headers. There's no lightweight fix available within a Raycast extension's constraints.
There aren't any real solutions to this other than forcing users to register for a developer account with Merriam to get an API key. I think that barrier to entry is likely too high for most users (which is why I went with a dead simple scraper to begin with). I don't see any other path than to actually take down this extension. @YourMCGeek @mbuvarp - any thoughts?
Merriam-Webster has tightened their bot detection and is now blocking all programmatic requests, even with browser-spoofed headers. There's no lightweight fix available within a Raycast extension's constraints.
There aren't any real solutions to this other than forcing users to register for a developer account with Merriam to get an API key. I think that barrier to entry is likely too high for most users (which is why I went with a dead simple scraper to begin with). I don't see any other path than to actually take down this extension. @YourMCGeek @mbuvarp - any thoughts?
That's a bummer. Do we have usage stats for this extension? Perhaps I'll just set up a custom service using MyThes, which we can use instead. If usage is not that high, it may even stay within free tier on certain hosting providers.
If Raycast trusts that I'll not store anything sensitive from the requests, that is.
EDIT: Or would it be possible to just add the MyThes library files to the extension? So it would be fully local. They're only 15MB combined.
Merriam-Webster has tightened their bot detection and is now blocking all programmatic requests, even with browser-spoofed headers. There's no lightweight fix available within a Raycast extension's constraints.
There aren't any real solutions to this other than forcing users to register for a developer account with Merriam to get an API key. I think that barrier to entry is likely too high for most users (which is why I went with a dead simple scraper to begin with). I don't see any other path than to actually take down this extension. @YourMCGeek @mbuvarp - any thoughts?
Ultimately I dont disagree with you here. I wonder, however, if it would be possible to just hardcode the API key to the extension. Obviously this comes with it's own set of challenges and concerns, but looking at the API registration page, it speaks more as a "per application" key versus a "per user". Alternatively, Raycast supports the built-in Dictionary.app on macOS which can be considered an alternative in the meanwhile.
Hi, I would love to keep the extension, as I use it almost daily as a non-native English speaker. Other extensions offer a setting where the user has to put the API key, which I don't find too complicated. I don't endorse the lockdown from the website owners, but it could be worse than having to get an API key to access their services.
I dug into this because the failure shape looked interesting, and I think the answer is better than a workaround.
The extension's src/lib/scraper.ts fetches merriam-webster.com/thesaurus/<word> with axios. Merriam-Webster is behind Cloudflare, and Cloudflare reads the TLS handshake before it reads a single header. Node's handshake does not look like a browser's, so the request is refused no matter what the request says about itself.
Tested from a clean residential connection, so the address is not a factor. Four combinations, same word, same minute:
| TLS handshake | User-Agent | result |
|---|---|---|
| Chrome | Chrome | 200, 913,063 bytes, the real page |
| Chrome | axios/1.7.2 |
403 |
| Node default | Chrome | 403 |
| Node default | axios/1.7.2 |
403 |
Both halves have to match. That is why setting a browser User-Agent on its own does not fix it, which is the usual first thing people try here.
Two things worth knowing before anyone spends time on it:
A headless browser does not solve this quietly. I tried Playwright against the same URL and it returned HTTP 200 with 27,520 bytes, 358 visible characters, and the page title "Just a moment...". That is Cloudflare's interstitial rendered and handed back as a success. Swapping axios for a browser would turn a clear 403 into an extension that silently shows nothing, or shows nonsense, which is harder to debug than the error you have now.
Merriam-Webster publish a free official API. dictionaryapi.com has a Collegiate Thesaurus product, free for non-commercial use with a key. Given the extension exists to look up synonyms, that is almost certainly the fix rather than any scraping change: no Cloudflare, no fingerprinting, no breakage the next time they tighten the rules. It also means the extension stops depending on a page layout that can change without notice.
Disclosure so you can weigh the above: I build a web extraction API, so this class of problem is my day job. I am deliberately not linking it, because for this extension the official API is the right answer and a third-party service would be the wrong one.
Thanks for such a deep dive @Darko893, really appreciate it!
Merriam-Webster publish a free official API.
dictionaryapi.com
This was brought up when the issue was originally opened by @ABukSwienty, with their response quoted below. Ultimately, given it's @ABukSwienty's extension originally, I'll defer to him how he thinks best to proceed.
There aren't any real solutions to this other than forcing users to register for a developer account with Merriam to get an API key. I think that barrier to entry is likely too high for most users (which is why I went with a dead simple scraper to begin with). I don't see any other path than to actually take down this extension. @YourMCGeek @mbuvarp - any thoughts?
For anyone interested: I took this existing extension and refactored it to use the official API. Getting an account is not great UX, but can be done in 5 minutes. Extension now works again like a charm.
https://github.com/Kovah/raycast-thesaurus
I had Claude fix this bug for me. I am using the extension it edited right now. Here's what it did:
"I got this working again by changing how the page is fetched, leaving the parsing code as it was. The 403 is Cloudflare rejecting Node’s TLS/HTTP2 fingerprint, so a browser User-Agent on axios or fetch doesn’t help. The macOS system /usr/bin/curl is let through when it uses HTTP/1.1 with a browser User-Agent. In scraper.ts I replaced axios.get with a small execFile("/usr/bin/curl", ["-q", "-s", "--http1.1", "-L", "--max-time", "10", "-A", <Safari UA>, "-w", "\n%{http_code}", "--", url]) helper, which returns the body and status code. A 404 still goes through the existing spelling-suggestion handling, and a 200 goes through the existing cheerio parsing. It needs no API key and no changes to the extension’s settings. I tested it against live pages. Valid words, capitalised words, typos with suggestions and invalid input all behave as before. The one limitation is that it relies on the macOS curl binary, so it wouldn’t work as-is on Windows, which the extension also lists as a platform. Whether Cloudflare keeps letting this through can’t be guaranteed."