yahoofinance-api icon indicating copy to clipboard operation
yahoofinance-api copied to clipboard

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

Open enkara opened this issue 4 years ago • 3 comments

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!

enkara avatar Apr 18 '21 09:04 enkara

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

code-monkey-101 avatar Jul 04 '21 14:07 code-monkey-101

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 avatar Sep 28 '22 08:09 wsat

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?

wsat avatar Feb 23 '23 14:02 wsat