Closed rdohms closed 1 year ago
Looks to be related to the same error people are seeing here: joshuaulrich/quantmod#382
I do see this in payload:
{
"finance": {
"result": null,
"error": {
"code": "Unauthorized",
"description": "Invalid Crumb"
}
}
}
Thank you for posting this. I was just about to push some optimizations and bug fixes. It looks like there is a deeper issue now. I will look into this issue in hopes that Yahoo Finance didn't just change their policy or disconnect their service.
You can always test the API directly with calls like this: https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US®ion=US&corsDomain=finance.yahoo.com&fields=symbol,marketState,regularMarketPrice,regularMarketChange,regularMarketChangePercent,preMarketPrice,preMarketChange,preMarketChangePercent,postMarketPrice,postMarketChange,postMarketChangePercent&symbols=CRM
I tried hitting the API directly, looks like I get the same error... I also found reports on reddit and stackoverflow. Maybe a new API is needed :(
$ curl https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US®ion=US&corsDomain=finance.yahoo.com&fields=symbol,marketState,regularMarketPrice,regularMarketChange,regularMarketChangePercent,preMarketPrice,preMarketChange,preMarketChangePercent,postMarketPrice,postMarketChange,postMarketChangePercent&symbols=CRM
[1] 18
[2] 19
[3] 20
[4] 21
[2] Done region=US
[3]- Done corsDomain=finance.yahoo.com
$ {"finance":{"result":null,"error":{"code":"Unauthorized","description":"Invalid Cookie"}}}
@jfessard A new API indeed. I really liked the data from Yahoo Finance as the end users weren't required to get an API key. The plugin just worked out of the box. If any of you know of other free and keyless APIs please let me know.
I was also playing with something like this as a fix, but I don't think it will work.
fetch('https://finance.yahoo.com') .then(response => response.text()) .then(data => { const crumb = str.match(/"crumb":"(.*?)"/)[1]; return fetch(
https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US®ion=US&corsDomain=finance.yahoo.com&fields=regularMarketPrice,regularMarketChange,regularMarketChangePercent,preMarketPrice,preMarketChange,preMarketChangePercent&symbols=AAPL&crumb=${crumb}); }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error));
They also have this problem in another repo, I think they found a fix but the code is written in R.
Much like other places hav reported, it seems to be intermittent. For example, today, it's working just fine.
I am requesting and adding the session ID to the data requests. Hopefully this fix will prevent the error in the future. A fix will be in the next version v1.1.10
Plugin button was frozen on the logo, took a look in the debug console and saw this:
Its trying to load this URL for my ticker
And its receiving this error:
I see the same thing when I try to load the link directly, did something switch to paid/authenticated at yahoo?