SShortSingh.
Back to feed

Google Trends API returns 429 on first request due to missing NID cookie

0
·1 views

Developers querying the Google Trends API programmatically encounter an HTTP 429 error on their very first request, even from a clean IP address. The error is not a rate-limit block but occurs because Google Trends requires an NID cookie that is only issued after visiting certain Google pages. A working fix involves making a warm-up GET request to a lightweight endpoint — specifically '/_/TrendsUi/data/batchexecute' — which returns a 405 status but sets the required 106-byte NID cookie at minimal data cost. Once that cookie is included in subsequent API calls, requests to '/trends/api/explore' return the expected 200 response with full data. The widely used 'pytrends' library, archived in April 2025, no longer handles this cookie handshake correctly, which is why many existing scrapers recently broke.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

EU Company Data: Which Countries Offer Free Business Checks Without an Account

A developer building a supplier verification tool has mapped out which EU countries allow free, account-free access to company data, finding significant gaps across the bloc. The European Commission's VIES system validates VAT numbers across all 27 EU member states and Northern Ireland for free, but only confirms registration status and does not indicate whether a company is solvent, trading, or struck off. Ten countries — including Romania, Poland, Estonia, France, and Bulgaria — offer additional data through national registers, with only six of those reporting company state such as insolvency or liquidation. Nine countries including Germany, Austria, Italy, and Spain have no free company data source at all, while another seven including Ireland, Belgium, and Sweden restrict access behind accounts, API keys, or payments. Poland stands out as the only EU member state where a bank account can be verified as belonging to a VAT-registered company, through a Ministry of Finance database known as the white list.

0
ProgrammingDEV Community ·

MicroLeague Sports dev reveals why sports data identity is harder than simulation

Eddie Solar, developer of MicroLeague Sports, writes in his third dev blog that building cross-era sports simulations proved far more challenging on the data side than on the simulation engine side. The core difficulty is what he calls an identity problem: franchises relocate and rebrand, and players cannot be treated as single consistent entities across time. Cases like the Cleveland Browns relocation and the Houston Oilers becoming the Tennessee Titans expose deep contradictions in how franchise identity can be modeled. Solar notes that no single schema cleanly resolves whether identity should follow an organization, a city, or a name, and that getting this wrong silently corrupts all downstream simulation results. The team's early engineering time was largely consumed by these entity resolution challenges before any meaningful normalization of historical statistics could begin.

0
ProgrammingDEV Community ·

Developer Builds Self-Hosted AI Support Widget Using Spring Boot to Avoid SaaS Fees

A developer has created an open-source, self-hosted AI customer support widget built with Spring Boot and Vanilla JavaScript, designed to eliminate reliance on third-party subscription platforms. The tool allows website owners to deploy an AI-powered chat widget on their own server using their own OpenAI API key, integrating it into any site with a single script tag. Key features include a customizable knowledge base, conversation history, brand customization, secure admin dashboard, and a human handoff system that captures visitor emails when AI cannot resolve a query. The developer intentionally avoided Retrieval-Augmented Generation in favor of a simpler prompt-based knowledge base, making deployment straightforward for small and medium-sized businesses. Future improvements being considered include streaming AI responses, with the project aimed at giving developers full ownership and control over their customer support infrastructure.

0
ProgrammingDEV Community ·

Why --host 0.0.0.0 in Python servers is not always the right choice

A common Uvicorn startup flag, --host 0.0.0.0, binds a server to all available network interfaces, but its appropriateness depends entirely on the deployment environment. On a local virtual machine with no proxy in front, the wildcard bind is necessary to make the service reachable from outside the VM. On a production server with a public IP, binding to 0.0.0.0 exposes the application directly to the internet, making loopback binding behind a reverse proxy like Caddy the safer architectural choice. Inside a Docker container, however, loopback binding fails because each container operates in its own isolated network namespace, making 0.0.0.0 necessary again — with actual external exposure controlled separately via the runtime's port mapping. The key insight is that the bind address governs reachability, not security in isolation, and the correct value shifts based on what sits in front of the process.