mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-08-07 01:33:52 +00:00
Yahoo Finance blocks standard ureq/rustls via TLS fingerprinting (JA3/JA4). Reverse-engineered from yfinance source: they use curl_cffi with Chrome impersonation. Fix: - Fetch cookie via curl-impersonate from fc.yahoo.com - Fetch crumb via curl-impersonate from query1.finance.yahoo.com/v1/test/getcrumb (correct URL: getcrumb, not getCrumb or csrfToken) - Parse Netscape cookie jar format, send cookies as header to quoteSummary - 401 retry: clear crumb + cookie jar, re-auth on next attempt - Crumb validation: reject HTML, empty, rate-limit responses - Add curl-impersonate-chrome to flake.nix devShell
40 lines
1.1 KiB
Nix
40 lines
1.1 KiB
Nix
{
|
|
description = "idx-cli — CLI tool for Indonesian stock market (IDX) analysis";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [ "rust-src" "rust-analyzer" ];
|
|
};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
rustToolchain
|
|
pkg-config
|
|
openssl
|
|
cargo-watch
|
|
cargo-nextest
|
|
prek
|
|
curl-impersonate-chrome # required for Yahoo Finance auth (--impersonate chrome)
|
|
];
|
|
|
|
env = {
|
|
RUST_BACKTRACE = "1";
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|