node-yahoo-finance2 icon indicating copy to clipboard operation
node-yahoo-finance2 copied to clipboard

[Feature Request] Make `getCrumbClear(...)` public API

Open kkimdev opened this issue 11 months ago • 1 comments

Feature Request

Wanted Feature

Expose getCrumbClear(...) Internal API

Use Cases

Sometimes we want to start from a clean state (just in case, for retry), and to my understanding there is no way to do that with public APIs. So requesting promoting the getCrumbClear() function to public.

kkimdev avatar Jan 20 '25 00:01 kkimdev

Hey, agree. It just might be quite a while until I can get to this, unfortunately. Will happily accept a PR in the meantime otherwise will report back here when I've had a chance to action this.

gadicc avatar Jan 24 '25 10:01 gadicc

Better late than never 😅

  • [x] Expose lib/getCrumb
  • [x] Document the module

So now you'll be able to:

import YahooFinance from "yahoo-finance2";
import { getCrumbClear } from "yahoo-finance2/lib/getCrumb";

const yahooFinance = new YahooFinance();
await getCrumbClear(yahooFinance._opts.cookieJar);

Obviously _opts.cookieJar should still be considered internal and could change in the future, but it hasn't for years.

This will be in the next v3 release. There will be an automated message here once it's published. Although v3 is not yet "official", nor marked with the @latest tag, many are using it succesfully. For more info on upgrading, see UPGRADING.md. Unfortunately, I don't have the capacity to backport fixes or code back to v2.

gadicc avatar Aug 26 '25 10:08 gadicc