PMassicotte / gtrendsR

R functions to perform and display Google Trends queries
352 stars 112 forks source link

Status code was not 200. Returned status code:401 #459

Closed malteh123 closed 2 months ago

malteh123 commented 2 months ago

Hello, I have just started to write my master thesis. For that I need to collect google search volumes as a proxy for investor attention. Further down I pasted the code I used. "ticker_gruppen" is a list of 1045 with 5 entries each. The ticker identifies companies that had an IPO. "zeit_gruppen" is also a list of 1045 with 5 entries each. An entry is for example "2023-09-28 2023-12-27". I found that I need oauth-token and that I then can use the googleAuthR-package in R. I went to this site "https://console.developers.google.com/" to open a new project and activate the Google Trends API. But I cannot find the Google Trends API on that website.. Can someone tell me what I am missing or doing wrong?

for (i in 1:length(ticker_gruppen)) { trends <- gtrends(keyword = ticker_gruppen[[i]], time = zeit_gruppen[[i]], geo = "US", gprop = "web", hl = "en-US", category = 0, compared_breakdown = FALSE, low_search_volume = FALSE, cookie_url = "https://trends.google.com/trends/", tz = 0, onlyInterest = FALSE)

print(trends) }

PMassicotte commented 2 months ago

There are no official Google Trends API. We are just trying our best to get the data.