Closed swiergot closed 1 year ago
I am seeing https://consent.yahoo.com/ being accessible, maybe it is region specific.
I have been playing with a different approach of first navigating to yahoo.com and grabbing the cookies from there. And then navigating to https://query1.finance.yahoo.com/v1/test/getcrumb
. The latter appears when accessing https://finance.yahoo.com/quote/NQ%3DF
.
When I simply go to consent.yahoo.com, I get the error page too. But when I open an incognito window and go to https://finance.yahoo.com/quote/NQ%3DF, I get redirected to consent.yahoo.com with some parameters. I think it just requires a valid session or something which is created only on regular pages.
It is the same every time I start with a fresh incognito window. The same happens to my HA when your component tries to open https://finance.yahoo.com/quote/NQ%3DF for the first time. After the consent form is submitted (with my changes), it redirects to https://finance.yahoo.com/quote/NQ%3DF and everything is as it used to be.
If you don't live in the EU, it is entirely possible that you will never be shown the cookies consent screen as it is required by the EU law. I suppose some websites take the easy way and show the consent form to everyone without exception, but there are also websites that show it or not based on geolocation.
That makes sense, I have never seen that consent page. I did VPN to Germany but still was not able to access that consent page. In US, the request just errors out with 401.
I assume you tried incognito when on VPN?
Just to be clear, API URLs do not redirect to consent.yahoo.com, only yahoo.com and finance.yahoo.com do.
I have also tried https://query1.finance.yahoo.com/v1/test/getcrumb but it works only after I visit yahoo.com and submit the consent form. So no real gain.
One additional note - this PR also fixes a bug in handling of crumbs containing a slash character encoded as a Unicode escape sequence.
Not related to the consent page. I suspect it is the reason why sometimes sensors become unavailable and come back after a while.
Got it. It works well from US region. Could we add something to the logging to differentiate it from the same logging within CONSENT_HOST check?
_LOGGER.debug("Response status: %d", response.status)
_LOGGER.debug("Response URL: %s", response.url)
Never mind, I have an idea to log the content as well. So I will adjust the logging. Thanks for looking into this.
Fixes #96.