iprak / yahoofinance

Home Assistant component which allows you to get stock updates from Yahoo finance.
MIT License
81 stars 11 forks source link

API no longer available #111

Closed jkearneyma closed 9 months ago

jkearneyma commented 9 months ago

403 forbidden, with link to https://bit.ly/yahoo-finance-api-feedback

"We’re sorry for the inconvenience, but API-level access to Yahoo Finance quotes data has been disabled.

Yahoo Finance licenses data from 3rd-party providers that do not currently authorize us to redistribute these data in API form. Licenses that authorize redistribution come with a greater cost that varies depending on a number of factors, including whether the data is for personal or commercial use, the type of data, the volume of queries, and additional features which may be available. "

iprak commented 9 months ago

Please enable debug logging and add that here.

jkearneyma commented 9 months ago

Debug log has entries like this: 2024-01-25 14:37:30.007 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Requesting data from 'https://query1.finance.yahoo.com/v7/finance/quote?symbols=^GSPC,^DJI,^IXIC,^VIX,ORCL,MSFT,AMZN,INTC,AAPL,GOOG,TSLA,AMD,NVDA,EURUSD=X' 2024-01-25 14:37:35.008 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Navigating to a base Yahoo page 2024-01-25 14:37:45.008 ERROR (MainThread) [custom_components.yahoofinance.coordinator] Timed out getting data from https://query1.finance.yahoo.com/v7/finance/quote?symbols=^GSPC,^DJI,^IXIC,^VIX,ORCL,MSFT,AMZN,INTC,AAPL,GOOG,TSLA,AMD,NVDA,EURUSD=X 2024-01-25 14:37:45.009 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Finished fetching YahooSymbolUpdateCoordinator data in 30.006 seconds (success: False) 2024-01-25 14:37:45.009 WARNING (MainThread) [custom_components.yahoofinance.coordinator] Error obtaining data, retrying in 20 seconds. 2024-01-25 14:37:50.013 ERROR (MainThread) [custom_components.yahoofinance.coordinator] Timed out getting crumb. 2024-01-25 14:37:50.015 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Crumb: None

jkearneyma commented 9 months ago

However, it appears this was a service outage on their side, because about 2 hours ago it changed to this:

2024-01-25 19:07:24.637 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Requesting data from 'https://query1.finance.yahoo.com/v7/finance/quote?symbols=^GSPC,^DJI,^IXIC,^VIX,ORCL,MSFT,AMZN,INTC,AAPL,GOOG,TSLA,AMD,NVDA,EURUSD=X' 2024-01-25 19:07:24.819 ERROR (MainThread) [custom_components.yahoofinance.coordinator] Received status 401 (Unauthorized Invalid Cookie) for https://query1.finance.yahoo.com/v7/finance/quote?symbols=^GSPC,^DJI,^IXIC,^VIX,ORCL,MSFT,AMZN,INTC,AAPL,GOOG,TSLA,AMD,NVDA,EURUSD=X 2024-01-25 19:07:24.820 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Finished fetching YahooSymbolUpdateCoordinator data in 0.819 seconds (success: False) 2024-01-25 19:07:24.820 WARNING (MainThread) [custom_components.yahoofinance.coordinator] Error obtaining data, retrying in 20 seconds. 2024-01-25 19:07:44.000 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Navigating to a base Yahoo page 2024-01-25 19:07:44.920 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Response 200, URL: https://finance.yahoo.com/quote/NQ=F 2024-01-25 19:07:44.921 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Cookies: Set-Cookie: A1=d=AQABBND3smUCEF6z1FA_FoC_9zWWWH18FqUFEgEBAQFJtGW8Zdw80iMA_eMAAA&S=AQAAAnl0yLaoA6jtQ2vw4gqJKhg; Domain=yahoo.com; expires=Sat, 25 Jan 2025 06:07:44 GMT; HttpOnly; Max-Age=31557600; Path=/; SameSite=Lax; Secure^M Set-Cookie: A1S=d=AQABBND3smUCEF6z1FA_FoC_9zWWWH18FqUFEgEBAQFJtGW8Zdw80iMA_eMAAA&S=AQAAAnl0yLaoA6jtQ2vw4gqJKhg; Domain=yahoo.com; Path=/; SameSite=Lax; Secure^M Set-Cookie: A3=d=AQABBND3smUCEF6z1FA_FoC_9zWWWH18FqUFEgEBAQFJtGW8Zdw80iMA_eMAAA&S=AQAAAnl0yLaoA6jtQ2vw4gqJKhg; Domain=yahoo.com; expires=Sat, 25 Jan 2025 06:07:44 GMT; HttpOnly; Max-Age=31557600; Path=/; SameSite=None; Secure 2024-01-25 19:07:44.921 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Accessing crumb page 2024-01-25 19:07:45.604 DEBUG (MainThread) [custom_components.yahoofinance.coordinator] Crumb response status: 200, URL: https://query2.finance.yahoo.com/v1/test/getcrumb

jkearneyma commented 9 months ago

It's not clear to me why the 403 response I got claims the API has been disabled. But I'm closing this since the problem went away somehow.

iprak commented 9 months ago

I am glad it got sorted out, thanks for digging into it.