-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YFinance changed their api's (or their security) #25
Comments
v6 of the API seems to work, not 7. |
@ktpx You saved me! :) |
I think they pulled the plug on v6 now. :( |
All projects I see using the Yahoo API are facing this. There is this nugget I got from the ticker issue report on the subject: https://stackoverflow.com/questions/76065035/yahoo-finance-v7-api-now-requiring-cookies-python Not sure how/if that helps... |
Saw somewhere that for instance, an url like this: |
achannarasappa/ticker#250 (comment) |
Totally different structure than the quotes. This show financial data. But atleast one can grab the currentprices. |
Crumb is a param that is easy to gain, not sure how it will behave in long term. For now, it is possible to generate crumb via I have had the same crumb for a few days now, so it's possible to cache it locally on disk to avoid this call. |
If you inspect the cookie header, it says one year. "Expires=Wed, 5 Jun 2024 22:54:09 GMT" |
Hi there, is there any workaround I could use to test ? This is broken for a while. |
So I have a fix for this and I have opened a PR for it. Not sure who should be reviewing it. |
I would love to review it, but i don't think we can get it in as i think the project is dead here. Maybe fork? |
Is it, though? There were a couple of PR that were merged a month ago by @ackleymi . |
My bad. Just add me to the pr if you want |
Doesn't look like I can add you, but feel free to head over the the PR and comment on it: #28 |
Done. Good job! |
Did they add some kind of rate limit? I don't get a crumb anymore, just "Too many requests". |
I don't have access to a machine with the library on it atm.
I'll check about this later today.
…On Thu, Jul 20, 2023 at 3:32 PM ktpx ***@***.***> wrote:
Did they add some kind of rate limit? I don't get a crumb anymore, just
"Too many requests".
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATT2NOHUSYZVJRSGVCHALXRGBTHANCNFSM6AAAAAAVGDRPD4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Not a software issue really, API.
Thats atleast the URL i used in my progs |
You need to have a cookie set when you call getcrumb.
Just calling to it from curl won't work.
…On Thu, Jul 20, 2023 at 4:19 PM ktpx ***@***.***> wrote:
I don't have access to a machine with the library on it atm. I'll check
about this later today.
… <#m_9094901114993369745_>
On Thu, Jul 20, 2023 at 3:32 PM ktpx *@*.*> wrote: Did they add some kind
of rate limit? I don't get a crumb anymore, just "Too many requests". —
Reply to this email directly, view it on GitHub <#25 (comment)
<#25 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAATT2NOHUSYZVJRSGVCHALXRGBTHANCNFSM6AAAAAAVGDRPD4
<https://github.com/notifications/unsubscribe-auth/AAATT2NOHUSYZVJRSGVCHALXRGBTHANCNFSM6AAAAAAVGDRPD4>
. You are receiving this because you commented.Message ID: @.*>
Not a software issue really, API.
curl https://query2.finance.yahoo.com/v1/test/getcrumb
Too Many Requests
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATT2M2VWMKEK3GUPQ4VOTXRGHG7ANCNFSM6AAAAAAVGDRPD4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I do set cookie in the code, curl was bad example. But I still get same error. It worked, and literary didnt work half hour later, no code changed, so gotta be something yahoo changed. |
Hum. I don't know what to say.
I just ran the "examples" program (examples/main.go) from my branch, and
everything works nicely.
…On Fri, Jul 21, 2023 at 10:54 AM ktpx ***@***.***> wrote:
I do set cookie in the code, curl was bad example. But I still get same
error.
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATT2KW72BSDMITUYRSZTLXRKJZNANCNFSM6AAAAAAVGDRPD4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Which site do you query to get the cookie? Seems might be the problem. Ive used fc.yahoo.com, as its the only one that worked for me. For regular api calls, query2. |
cookieURL = "https://login.yahoo.com"
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0)
Gecko/20100101 Firefox/113.0"
func fetchCookies() (string, time.Time, error) {
client := http.Client{}
request, err := http.NewRequest("GET", cookieURL, nil)
if err != nil {
return "", time.Time{}, err
}
request.Header = http.Header{
"Accept": {"*/*"},
"Accept-Encoding": {"gzip, deflate, br"},
"Accept-Language": {"en-US,en;q=0.5"},
"Connection": {"keep-alive"},
"Host": {"login.yahoo.com"},
"Sec-Fetch-Dest": {"document"},
"Sec-Fetch-Mode": {"navigate"},
"Sec-Fetch-Site": {"none"},
"Sec-Fetch-User": {"?1"},
"TE": {"trailers"},
"Update-Insecure-Requests": {"1"},
"User-Agent": {userAgent},
}
func fetchCrumb(cookies string) (string, error) {
client := http.Client{}
request, err := http.NewRequest("GET", crumbURL, nil)
if err != nil {
return "", err
}
request.Header = http.Header{
"Accept": {"*/*"},
"Accept-Encoding": {"gzip, deflate, br"},
"Accept-Language": {"en-US,en;q=0.5"},
"Connection": {"keep-alive"},
"Content-Type": {"text/plain"},
"Cookie": {cookies},
"Host": {"query1.finance.yahoo.com"},
"Sec-Fetch-Dest": {"empty"},
"Sec-Fetch-Mode": {"cors"},
"Sec-Fetch-Site": {"same-site"},
"TE": {"trailers"},
"User-Agent": {userAgent},
}
…On Fri, Jul 21, 2023 at 10:58 AM ktpx ***@***.***> wrote:
Which site do you query to get the cookie? Seems might be the problem. Ive
used fc.yahoo.com, as its the only one that worked for me. For regular
api calls, query2.
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATT2ON5ODH36WILOHXD6DXRKKKFANCNFSM6AAAAAAVGDRPD4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Ok using login subdomain again got me the cookie, but still no crum. Mind showing your crumb URL.....? I didnt find it in the source |
I will refer you to my pull request: You should be able to get everything you need there. |
Thanks, its same url. Im guessing they are doing some IP based limiting, or blocking, im just getting the too many requests from here (EU). |
Have you sync'd my branch and run the |
Ok, confirmed is a location issue. So ill assume people using this tool wil also have |
So, that means this solution is only working if the request is made in the US? |
For the quotes API, it seems so yes. But I can't speak for other countries. But ive tried in 3 different EU countries, and no dice. It worked for a while, but no more. |
|
I have it working by using a fork (not mine). If you want i can look it up today or tomorrow. |
@TobiasFP It would be great if you could share this :) |
This is the go.mod replacement line: replace github.com/piquette/finance-go => github.com/joce/finance-go v0.0.0-20230508165157-c2477f741cdd |
Hi.
There seams to be an issue with the finance-go, since yFinance changed its encryption keys.
Apparantly they change their encryption keys every day or even sometimes more than once a day.
This has lead to finance-go not working for a while.
yFinance has the same issue:
ranaroussi/yfinance#1407
I just wanted to bring it to your attention. I have been very happy with this library, so thank you very much for your work.
The text was updated successfully, but these errors were encountered: