Playground Sign in Start free
News and finance · finance.yahoo.com

How to scrape Yahoo Finance

Yahoo Finance (finance.yahoo.com) is a news and finance site. This guide is built from our own checks of its public pages: what the pages contain, whether our requests get through right now, and the request settings that worked.

Ujeebu scrapes any public website. Not listed here? Try any URL in the Playground or ask us about a site.

Working 5 credits a page, about $0.50 per 1,000 on Pro

22 of 22 of our checks passed in the last 7 days (100%).

Last check 2026-11-22 23:05 UTC · last pass 2026-11-22 23:05 UTC · checked with our own requests, never customer data.

Try it in the Playground

Recipe one call

Use the Yahoo Finance recipe: send the URL, get JSON

5 credits (JS) a page
curl -G 'https://api.ujeebu.com/scrape' \
  -H "ApiKey: $UJEEBU_API_KEY" \
  --data-urlencode 'url=https://finance.yahoo.com/quote/MSFT/' \
  --data-urlencode 'recipe=yahoo-finance'

The answer is {"result": {...}} with the fields of the recipe. Billed like any /scrape call: successful responses cost credits; blocked, timed-out and failed requests are free.

Run the code on this page with your own key: 5,000 free credits for 7 days, no card. Get a free API key →

Recipe

Call the recipe by name with the recipe parameter: the Scrape API applies its extract rules and the settings that work on Yahoo Finance. Each recipe was run on two real Yahoo Finance pages and keeps only the fields that came back on both; it is checked again every week, and hidden if it stops working.

Public pages

Validated 2026-11-22

One call: recipe=yahoo-finance 5 credits (JS) a page

curl -G 'https://api.ujeebu.com/scrape' \
  -H "ApiKey: $UJEEBU_API_KEY" \
  --data-urlencode 'url=https://finance.yahoo.com/quote/MSFT/' \
  --data-urlencode 'recipe=yahoo-finance'

The answer is {"result": {...}} with the fields below; the Ujb-Recipe header names the version (for example yahoo-finance/page@v1) and Ujb-Credits the cost.

What this recipe extracts

FieldTypeExample
titletextMicrosoft Corporation (MSFT) Stock Price, News, Quote & History - Y...
descriptiontextFind the latest Microsoft Corporation (MSFT) stock quote, history,...
imageURLhttps://pinhole.finance.yahoo.com/chart/MSFT/__screenshot
urlURLhttps://finance.yahoo.com/quote/MSFT/
headlinetextMicrosoft Corporation (MSFT)
sectiontextNasdaqGS - Nasdaq Real Time Price • USD
summarytextMicrosoft’s latest coverage centers on its AI infrastructure expans...
quote.52_week_rangetext349.20 - 559.15
quote.avg_volumenumber (as text)23,187,764
quote.betanumber (as text)1.04
quote.changetext-2.78
quote.change_percenttext-0.52%
quote.currencytextUSD
quote.day_rangetext524.61 - 538.30
quote.dividend_yieldtext3.92 (0.73%)
quote.earnings_datetextJan 27, 2027
quote.epsnumber (as text)19.16
quote.exchangetextNasdaqGS
quote.market_captext3.959T
quote.nametextMicrosoft Corporation
quote.opennumber (as text)525.00
quote.pe_rationumber (as text)27.82
quote.previous_closenumber (as text)535.93
quote.pricenumber (as text)533.15
quote.symboltextMSFT
quote.target_pricenumber (as text)634.14
quote.updated_attext1:31:54 PM EST
quote.volumenumber (as text)12,250,546

Examples from finance.yahoo.com/quote/MSFT/ on 2026-11-22, shortened.

Sample output (real, trimmed)

{
    "quote": {
        "52_week_range": "349.20 - 559.15",
        "avg_volume": "23,851,139",
        "beta": "1.04",
        "change": "-13.78",
        "change_percent": "-2.77%",
        "currency": "USD",
        "day_range": "481.03 - 503.80",
        "dividend_yield": "3.92 (0.81%)",
        "earnings_date": "Jan 27, 2027",
        "eps": "19.16",
        "exchange": "NasdaqGS",
        "market_cap": "3.598T",
        "name": "Microsoft Corporation",
        "open": "493.47",
        "pe_ratio": "25.29",
        "previous_close": "498.30",
        "price": "484.52",
        "symbol": "MSFT",
        "target_price": "636.12",
        "updated_at": "At close: November 20 at 4:00:00 PM EST",
        "volume": "47,200,018"
    },
    "title": "Microsoft Corporation (MSFT) Stock Price, News, Quote & History - Yahoo Finance",
    "description": "Find the latest Microsoft Corporation (MSFT) stock quote, history, news and other vital information to help you with your stock trading and investing.",
    "image": "https://pinhole.finance.yahoo.com/chart/MSFT/__screenshot",
    "url": "https://finance.yahoo.com/quote/MSFT/",
    "headline": "Microsoft Corporation (MSFT)",
    "section": "NasdaqGS - Nasdaq Real Time Price • USD",
    "summary": "Microsoft remains central to investor debate about AI spending, cash generation, and demand quality. Recent coverage points to new institutional buying, a Da..."
}
extract_rules (8 rules): the rules behind the recipe

The API applies these rules and the settings js=true for you when you send recipe=yahoo-finance. To change what comes back, send your own extract_rules (they replace the recipe's) or any setting (yours always win). Sites without a recipe work the same way with extract rules.

{
    "title": {
        "selector": "meta[property=\"og:title\"]",
        "type": "attr",
        "attribute": "content"
    },
    "description": {
        "selector": "meta[property=\"og:description\"]",
        "type": "attr",
        "attribute": "content"
    },
    "image": {
        "selector": "meta[property=\"og:image\"]",
        "type": "attr",
        "attribute": "content"
    },
    "url": {
        "selector": "link[rel=\"canonical\"]",
        "type": "attr",
        "attribute": "href"
    },
    "headline": {
        "selector": "h1.heading",
        "type": "text"
    },
    "section": {
        "selector": "span.exchange",
        "type": "text"
    },
    "summary": {
        "selector": "div.summary p",
        "type": "text"
    },
    "quote": {
        "type": "fn",
        "fn": "const st = {}; document.querySelectorAll('[data-testid=\"quote-statistics\"] li').forEach(li => { const l = li.querySelector('.label'); const v = li.querySelector('.value'); if (l && v) st[l.textContent.trim().toLowerCase()] = v.textContent.trim(); }); const pick = re => { const k = Object.keys(st).find(x => re.test(x)); return k ? st[k] : null; }; const txt = s => { const e = document.querySelector(s); return e ? e.textContent.trim() : null; }; const h1 = txt('[data-testid=\"quote-title\"] h1') || txt('h1'); const m = h1 ? h1.match(/^(.*)\\s+\\(([^()]+)\\)\\s*$/) : null; const ex = [...document.querySelectorAll('span.exchange > span')].map(s => s.textContent.trim()).filter(t => t && t !== '•'); const pct = txt('[data-testid=\"qsp-price-change-percent\"]'); const t = txt('.marketTimeNotice'); const price = txt('[data-testid=\"qsp-price\"]'); if (!price) return null; return { symbol: m ? m[2] : null, name: m ? m[1] : h1, price: price, change: txt('[data-testid=\"qsp-price-change\"]'), change_percent: pct ? pct.replace(/[()]/g, '') : null,  currency: ex.length > 1 ? ex[ex.length - 1] : null, exchange: ex.length ? ex[0].split(' - ')[0] : null,  previous_close: pick(/^previous close/), open: pick(/^open$/), day_range: pick(/^day.s range/), '52_week_range': pick(/^52 week range/),  volume: pick(/^volume$/), avg_volume: pick(/^avg\\. volume/), market_cap: pick(/^market cap/), beta: pick(/^beta/), pe_ratio: pick(/^pe ratio/), eps: pick(/^eps/),  earnings_date: pick(/^earnings date/), dividend_yield: pick(/dividend .* yield|^yield/), target_price: pick(/target est/), updated_at: t ? t.replace(/\\.?\\s*market (open|closed)\\.?$/i, '').replace(/^as of\\s*/i, '').trim() : null };"
    }
}

Code

Complete scripts: set the UJEEBU_API_KEY environment variable and run them as they are. Each one calls the recipe by name (the Go SDK has no recipe field, so the Go script sends the recipe's rules and settings itself), prints the extracted JSON, and prints the credits the request cost (the Ujb-Credits response header) on stderr. A non-200 answer stops the script with the API's error message.

Public pages

Runs the recipe on the two pages it was validated on, one after the other.

yahoo_finance_page_sdk.py pip install ujeebu-python==0.1.5
# Scrape Yahoo Finance public pages with the Ujeebu Scrape API.
# Calls the recipe yahoo-finance: the API applies its extract rules and validated settings (validated 2026-11-22). Send extract_rules or any setting to override them.
# Uses the official SDK ujeebu-python 0.1.5: pip install ujeebu-python==0.1.5
# Run: UJEEBU_API_KEY=your_key python3 yahoo_finance_page_sdk.py

import json
import os
import sys
import time

import requests
from ujeebu_python import UjeebuClient

API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
    "https://finance.yahoo.com/quote/MSFT/",
    "https://finance.yahoo.com/quote/JPM/",
]
RECIPE = "yahoo-finance"  # rules and settings come from the recipe; add your own to override them


def scrape(client, url):
    # a GET with recipe=: the API applies the recipe and answers {"result": {...}}
    try:
        response = client.scrape(url, params={"recipe": RECIPE})
    except requests.RequestException as error:
        sys.exit(f"Request failed for {url}: {error}")
    if response.status_code != 200:
        try:
            message = response.json().get("message", response.text)
        except ValueError:
            message = response.text
        sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
    print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}, Ujb-Recipe: {response.headers.get('Ujb-Recipe')}", file=sys.stderr)
    return response.json()["result"]


if not API_KEY:
    sys.exit("Set the UJEEBU_API_KEY environment variable.")

client = UjeebuClient(api_key=API_KEY)

for i, url in enumerate(URLS):
    if i:
        time.sleep(2)  # be polite: one page at a time
    result = scrape(client, url)
    quote = result.get("quote") or {}
    print(quote.get("symbol"), quote.get("price"), quote.get("change_percent"), quote.get("market_cap"))
    # Example output: MSFT 484.52 -2.77% 3.598T
    # every field: print(json.dumps(result, indent=2, ensure_ascii=False))

SDK tabs use the official Ujeebu SDKs (ujeebu-python 0.1.5, @ujeebu-org/ujeebu-sdk 0.1.2, github.com/ujeebu/ujeebu-go v0.1.8); there is no PHP SDK, so the PHP tab calls the API with curl. For agents and scripts, the same status and settings are at /scrape/yahoo-finance.json.

Try it yourself

Run this on Yahoo Finance with your own key

Get a free API key, set UJEEBU_API_KEY and run any script above as it is. 5,000 free credits for 7 days, no card.

URL patterns and pagination

What the URLs look like, read from the pages our checks fetched.

Public pages

Pattern
https://finance.yahoo.com/quote/{slug}/
Validated on
https://finance.yahoo.com/quote/MSFT/https://finance.yahoo.com/quote/JPM/

Settings that work today

From our health checks over the last 7 days: the cheapest settings that return the real page most of the time.

Endpoint/scrape
jstrue
wait_for15000
Costup to 5 credits a request
Learnedjs + wait 15000 (found by our retry layer)

Each public page is one request: change the path in the URL to fetch another one. Our checks pass with JavaScript rendering on (js=true) and a wait of 15 seconds (wait_for=15000) before the snapshot: keep both.

Try it in the Playground

What people build with Yahoo Finance data

  • Media monitoringTrack the articles published on the topics and companies you follow.More on this use case
  • Content for AI and RAGCollect headlines, dates and summaries as structured input for search and LLM pipelines.More on this use case
  • Publishing timelineMeasure when and how often a site publishes, by section.

Limits and etiquette

  • Public pages only. Pages behind a login, and data shown only to signed-in users, are out of scope.
  • Keep the rate modest: fetch pages one after another or with low concurrency, and cache what you already have.
  • robots.txt of finance.yahoo.com (read 2026-11-17): public pages allowed for generic crawlers; no crawl delay set.
  • Read Yahoo Finance's terms of service before you collect data at scale, and do not collect personal data you have no basis to process. This guide is not legal advice.

Questions

Can you scrape Yahoo Finance with Ujeebu?

Yes. 22 of 22 checks of public Yahoo Finance pages passed in the last 7 days with the settings on this page.

Which settings work for Yahoo Finance?

Call /scrape with js=true, wait_for=15000. Our retry layer found that this site needs "js + wait 15000".

How many credits does a Yahoo Finance request cost?

With these settings a request costs up to 5 credits. Only responses with HTTP 200 or 404 are billed: a blocked or timed-out request is free.

Which fields can I extract from Yahoo Finance?

With the extraction recipes on this page, validated on real Yahoo Finance pages through our API: public pages: title, description, image, url, headline, section, summary, 52_week_range, avg_volume, beta, change, change_percent. Pass the recipe as extract_rules in a POST to /scrape and the API returns those fields as JSON.

Is it allowed to scrape Yahoo Finance?

Its robots.txt allows generic crawlers on the page types in this guide. Collect public pages only, read Yahoo Finance's terms of service, keep your request rate modest and do not collect personal data you have no basis to process. This is not legal advice.

How fresh is this page?

The status and settings come from our own health checks of finance.yahoo.com, which run around the clock. Last check: 2026-11-22 23:05:43 UTC; last pass: 2026-11-22 23:05:43 UTC.