Quick answer: Yahoo Finance is a great place to read market data, but its terms of use restrict automated scraping and redistribution, and it has no supported public API. For quotes, fundamentals, and price history, the compliant path is a licensed market-data or broker API (Alpha Vantage, Polygon, Finnhub, Tiingo, or your broker's own API). Many developers do use unofficial Yahoo libraries, but that is at their own risk. When you genuinely need a public page an API does not cover, fetch that single page carefully.
What people actually want from Yahoo Finance
When someone asks how to scrape Yahoo Finance, they almost always want one of three things:
- Quotes: current or delayed price for a ticker.
- Fundamentals: financials, ratios, earnings, and company profile data.
- History: daily or intraday OHLCV bars for backtesting or charts.
All three are available from dedicated market-data providers with proper licensing. That matters, because market data is often licensed data, and the exchange that produces it has rules about redistribution. Scraping a display site does not launder those rules away.
The compliant options, ranked by what you need
| Provider | Strong for | Auth style | Notes |
|---|---|---|---|
| Your broker's API | Real-time quotes, your own account data | Token / OAuth | Best if you already trade there |
| Alpha Vantage | Quotes, fundamentals, FX, indicators | API key (query param) | Generous free tier, check current limits |
| Polygon.io | Real-time and historical, tick data | Bearer token | Deep history, paid tiers |
| Finnhub | Quotes, fundamentals, news | API key | Broad coverage |
| Tiingo | End-of-day history, fundamentals | Token | Clean historical data |
| SEC EDGAR | Official filings and financials | None | Free, authoritative for fundamentals |
I put SEC EDGAR on that list on purpose. If you want fundamentals for US companies, the numbers on Yahoo ultimately trace back to filings. Going to the source (EDGAR) is both free and authoritative. We wrote a whole guide on that: extract financial data from earnings and filings.
A note on auth headers
Some finance APIs, like Polygon, use Authorization: Bearer YOUR_TOKEN. That is normal and fine for those services. Just do not carry that habit over to link.sc: link.sc uses x-api-key, never Authorization: Bearer. Different services, different conventions.
Here is a quick quotes example against a market-data API (Alpha Vantage, which passes the key as a query parameter):
import requests
resp = requests.get(
"https://www.alphavantage.co/query",
params={
"function": "GLOBAL_QUOTE",
"symbol": "AAPL",
"apikey": "YOUR_ALPHAVANTAGE_KEY",
},
)
quote = resp.json()["Global Quote"]
print(quote["05. price"])
And a Bearer-style provider for historical bars:
import requests
resp = requests.get(
"https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2026-01-01/2026-06-30",
headers={"Authorization": "Bearer YOUR_POLYGON_TOKEN"},
)
for bar in resp.json().get("results", []):
print(bar["t"], bar["c"])
Confirm each provider's current rate limits and licensing on their own pricing pages, since terms differ on real-time versus delayed data and on redistribution rights.
The reality of unofficial Yahoo libraries
You have probably seen open-source libraries that pull data from Yahoo Finance endpoints. They work, they are popular, and they are also unsupported reverse-engineered access to a service that does not offer a public API. Yahoo can and does change or restrict those endpoints without warning, and the terms of use do not bless automated pulls.
If you use one, be honest with yourself about the tradeoff: it is convenient today and unreliable tomorrow, and it sits outside the terms. For anything you plan to ship, depend on it, or redistribute, use a licensed API instead.
When fetching a public page is the right call
There is a narrow legitimate case: a specific public page (a company's investor-relations page, a public press release, a public product page) carries information no market-data API exposes, and you just need to read it. That is a fetching job, not a market-data job.
link.sc fetches a public URL and returns clean markdown, so you can hand it straight to an LLM instead of writing selectors. The base is https://api.link.sc/v1 and the header is x-api-key.
curl -X POST https://api.link.sc/v1/fetch \
-H "x-api-key: lsc_your_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://investor.examplecorp.com/press-release/q2-results",
"format": "markdown"
}'
The response is { "content": "..." }. To pull specific numbers out of that markdown reliably, see extract structured JSON from any webpage.
You can also search for the primary source rather than guessing at a URL:
curl -X POST https://api.link.sc/v1/search \
-H "x-api-key: lsc_your_key" \
-H "Content-Type: application/json" \
-d '{
"q": "ExampleCorp Q2 2026 earnings press release",
"engine": "google"
}'
The search field is q, and the response contains serpData.
Legal and ethics note
Market data is frequently licensed, and financial sites' terms of use commonly restrict automated collection and redistribution. Scraping a display page to redistribute quotes can run into both the site's terms and the exchange's licensing. None of this is legal advice, but the safe pattern is clear: use a provider that licenses the data to you for your use case, respect rate limits, and do not bypass access controls. For the general legal landscape, see is web scraping legal.
What I would build
- If you have a brokerage account, start with its API for real-time quotes and your own data.
- For history and fundamentals, use a licensed provider (Alpha Vantage, Polygon, Finnhub, Tiingo) sized to your volume.
- For authoritative US fundamentals, go straight to SEC EDGAR.
- For the occasional public page an API does not cover, fetch that one page with link.sc and extract fields with an LLM.
That stack gets you licensed, reliable data and keeps a fetching tool in reserve for the genuine gaps. The APIs are the right answer for market data. Fetching is for the public-page edges.
Need the public pages the finance APIs miss? link.sc turns any URL into clean, structured content. Start free.