sstrickx / yahoofinance-api

Java Client API for Yahoo Finance
MIT License
507 stars 222 forks source link

Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options #176

Open enkara opened 3 years ago

enkara commented 3 years ago

Recently I got those messeages when downloading some data.

Apr. 18, 2021 11:16:37 AM java.net.CookieManager put
SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Domain=DELETE; Expires=Sun, 18 Apr 2021 09:06:36 GMT; Max-Age=0; Domain=yahoo.com; Path=; Secure; HttpOnly
Apr. 18, 2021 11:16:37 AM java.net.CookieManager put
SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Domain=DELETE; Expires=Sun, 18 Apr 2021 09:06:36 GMT; Max-Age=0; Domain=finance.yahoo.com; Path=; Secure; HttpOnly

Has anyone an idea what the cause might be and how to solve this issue? Thanks!

code-monkey-101 commented 3 years ago

Same here:

Jul 04, 2021 4:36:17 PM java.net.CookieManager put SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Domain=DELETE; Expires=Sun, 4 Jul 2021 14:26:22 GMT; Max-Age=0; Domain=yahoo.com; Path=; Secure; HttpOnly Jul 04, 2021 4:36:17 PM java.net.CookieManager put SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Domain=DELETE; Expires=Sun, 4 Jul 2021 14:26:22 GMT; Max-Age=0; Domain=finance.yahoo.com; Path=; Secure; HttpOnly Jul 04, 2021 4:36:17 PM java.net.CookieManager put SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Path=DELETE; Expires=Sun, 4 Jul 2021 14:26:22 GMT; Max-Age=0; Domain=yahoo.com; Path=; Secure; HttpOnly Jul 04, 2021 4:36:17 PM java.net.CookieManager put SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Path=DELETE; Expires=Sun, 4 Jul 2021 14:26:22 GMT; Max-Age=0; Domain=finance.yahoo.com; Path=; Secure; HttpOnly Jul 04, 2021 4:36:17 PM java.net.CookieManager put SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Version=DELETE; Expires=Sun, 4 Jul 2021 14:26:22 GMT; Max-Age=0; Domain=yahoo.com; Path=; Secure; HttpOnly Jul 04, 2021 4:36:17 PM java.net.CookieManager put SEVERE: Invalid cookie for https://finance.yahoo.com/quote/%5EGSPC/options: $Version=DELETE; Expires=Sun, 4 Jul 2021 14:26:22 GMT; Max-Age=0; Domain=finance.yahoo.com; Path=; Secure; HttpOnly

I'm only getting it when I am in Germany, not in the US.

Maybe it has something to do with this popup: cookies

wsat commented 2 years ago

The issue seems to be the '$' character at the beginning of the key-names ($Domain, $Path, $Version). check out java.net.HttpCookie.class : HttpCookie(String name, String value, String header, long creationTime) { name = name.trim(); if (name.isEmpty() || !isToken(name) || name.charAt(0) == '$') { throw new IllegalArgumentException("Illegal cookie name"); } ... throws an IllegalArgumentException, if the cookie contains a $ character at index 0. Not sure what to do about this...

wsat commented 1 year ago

Hi, has anybody found a solution for this problem? Am I understanding this correctly: Yahoo-Finance sends cookies with keys that have illegal characters (i.e. $). Any way to clean this up, manually?