yahoo-finance-api icon indicating copy to clipboard operation
yahoo-finance-api copied to clipboard

Yahoo! We will right back...

Open yasinaslan16 opened this issue 1 year ago • 6 comments

https://fc.yahoo.com/ is problematic because the system is running extremely slow and sometimes gives errors. Has anyone found an alternative solution? WhatsApp Image 2023-12-06 at 13 45 22

yasinaslan16 avatar Dec 06 '23 10:12 yasinaslan16

I'm wondering about this issue too.. its become extremely slow the past few weeks.

Have you found a solution?

N1njaWTF avatar Jan 04 '24 14:01 N1njaWTF

I tweaked the $initialUrl in ApiClient.php around line 212. Grabbing that initial cookie from another Yahoo site vs fc.yahoo.

$initialUrl = 'https://sports.yahoo.com';

vikrampant avatar Jan 04 '24 15:01 vikrampant

I see the issue of slowness with the fc.yahoo.com domain as well. Though I haven't found a good alternative yet.

The suggested sports.yahoo.com doesn't do it for me, as I'm getting "Invalid Cookie" errors further down the line.

scheb avatar Jan 06 '24 14:01 scheb

Forgot to mention I also added another value in the header to the user agent. I pulled that from other Guzzle-based scripts I've used in the past.

public function getHeaders(): array
    {
        return [
            'User-Agent' => $this->userAgent,
            'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
        ];
    }

vikrampant avatar Jan 06 '24 22:01 vikrampant

Thanks for the hint! That gets the call to sports.yahoo.com working, but it doesn't initialize an A3 cookie (fc.yahoo.com does). I get a GUCS cookie instead and that doesn't seem to be sufficient to retrieve a crumb. Fetching a crumb gets me a error 500 response back.

I believe it has something to do with different locations. Especially in the EU (I'm in Germany) where we have GDPR, you have to accept the terms and conditions to get proper cookies initialized.

scheb avatar Jan 07 '24 13:01 scheb

did anyone find a solution yet? :) for my tool i programmed, its very unfortunate to have such long loading times when trying to query something from Yahoo Finance..

N1njaWTF avatar Jan 22 '24 14:01 N1njaWTF