Skip to content

Latest commit

 

History

45 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TipRanks Scraper — Smart Score, Analyst Ratings and Price Targets in Python

release tests canary python licence engines credentials-optional

TipRanks scraper — an open-source (MIT) Python tool that reads a ticker's tipranks.com stock-analysis page and writes its Smart Score, analyst consensus (Buy/Hold/Sell) and average price target to JSON or CSV, with no account or login. The default is a local headless Chromium with no proxy and no key, but Cloudflare challenges the page: on 2026-11-30 every datacentre client tried was refused, and the 2Captcha Scraping Browser API (--cdp-endpoint) got through. Use it to track analyst sentiment and price targets across a watchlist, or to compare two runs with the bundled diff tool.

Scrapes one thing from tipranks.com: a stock ticker's stock-analysis page snapshot — Smart Score, analyst consensus (Buy/Hold/Sell), and average price target — from the site's free, unauthenticated data. No account, no login required for a normal run — this repo is local-first: the default is a plain local headless Chromium against a free, public page, no proxy, no captcha-solving key. --proxy/--cdp-endpoint/ --fingerprint/--twocaptcha-key/--scraper-api (added 2026-09-28, after a real Cloudflare block was observed — see "What's actually in front of the site" below) are opt-in from a connection the site serves. From a datacentre address they are not optional: since November 2026 (measured 2026-11-30) the page answers one with Cloudflare's managed challenge, and --cdp-endpoint got through. Three engines (Playwright, Selenium, Puppeteer/pyppeteer) with an identical CLI, output schema and exit codes. JSON or CSV output.

Example output

{
  "ticker": "AAPL",
  "source": "tipranks",
  "source_url": "https://www.tipranks.com/stocks/aapl/stock-analysis",
  "scraped_at": "2026-12-01T08:49:33.472907+00:00",
  "company_name": "Apple",
  "currency": "USD",
  "smart_score": 7,
  "smart_score_updated": "2026-11-25T00:00:00.000Z",
  "consensus_rating_id": "Moderate Buy",
  "consensus_rating_label": "Moderate Buy",
  "analyst_count": 28,
  "buy_count": 15,
  "hold_count": 7,
  "sell_count": 6,
  "price_target_average": 346.89652173913043,
  "price_target_upside": -0.020066322770819208,
  "current_price": 354,
  "current_price_asof": "2026-11-30",
  "current_price_source": "regular",
  "dividend_yield": 0.0030225951638418076,
  "last_earnings_date": "2026-11-02",
  "next_earnings_date": "2027-02-04"
}

The core columns of the AAPL row in sample_output.json (1 row, 63 columns), read from the ticker page on 2026-12-01 through the 2Captcha Scraping Browser API by the canary's canary-live job (run 46610407982); the free path from a datacentre address was refused by Cloudflare the next day (exit 3). The other 41 columns — those listed as always empty under What it reads — are null in it.

Requirements and access

Runtime Python 3.9 or newer; Playwright with its Chromium (primary), Selenium or pyppeteer — one engine per virtualenv
Coverage One page per ticker, tipranks.com's stock-analysis page: Smart Score, the analyst consensus with its Buy/Hold/Sell counts, the average price target and its upside, the last session's price, dividend yield and earnings dates. US tickers measured (a . as in BRK.B works). No account or login. See Coverage and limitations
Required from a server (datacentre address) An exit Cloudflare lets through: the 2Captcha Scraping Browser API (--cdp-endpoint, TIPRANKS_CDP_ENDPOINT). Since November 2026 a datacentre IP gets Cloudflare's managed challenge — curl, headless and headful Chromium alike (2026-11-30), a Hetzner server again on 2026-12-02 (exit 3) — while the Scraping Browser got through (2026-11-30; the canary on 2026-12-01)
From a home connection Not re-measured since the route change; the default — a local headless Chromium with no proxy and no key — is what such a run uses
Optional: a proxy --proxy / --proxy-file (TIPRANKS_PROXY): a fresh exit IP; not measured against the November 2026 challenge. A proxied run is metered and stops at --proxy-budget-mb (10 MB by default)
Optional: 2Captcha Scraper API --scraper-api with TWOCAPTCHA_KEY: one browserless call per ticker, or through your Scraping Browser session with --scraper-api-cdp; last verified live on 2026-10-19, on the earlier route
Captcha solving The block is Cloudflare's managed challenge, which this repo does not solve locally; the Scraping Browser clears it. No captcha widget has been observed
Measured 2026-12-02 at commit 8203ad0, a Hetzner datacentre address with no proxy (refused, exit 3); the canary through the Scraping Browser, green on 2026-12-01. See Verification

Quick start

git clone https://github.com/2scraper/tipranks-scraper
cd tipranks-scraper
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements-playwright.txt
playwright install chromium
cp .env.example .env      # on a server: a Scraping Browser endpoint in TIPRANKS_CDP_ENDPOINT

python3 playwright_scraper.py --ticker AAPL --ticker MSFT --format json --out results.json

It writes results.json — one row per ticker — and results.json.meta.json beside it, with the status, the failed tickers and, for a proxied run, the traffic used.

If the run does not end with exit 0:

  • exit 3, blocked — Cloudflare's challenge did not clear within 20 s. From a datacentre address that is expected: use --cdp-endpoint.
  • exit 4, zero results — every ticker answered with the site's own not-found page: check the symbol.
  • exit 5 or 6, not obtained or partial — 5: no rows (a navigation or network failure, a refused proxy credential, or a served page without the ticker's data — parser_failed, as the retired payload.json route now gives); 6: some tickers failed. See Output contract.

Setup, .env and exit codes for the whole family: How to run the 2scraper scrapers.

Coverage and limitations

  • No confirmed CAPTCHA widget on this site — captcha_solver.py's solving plumbing is shipped for family parity and may simply find nothing to solve; see "2Captcha toolkit" below.
  • The ticker page sits behind a Cloudflare managed challenge that this repo does not solve locally; --cdp-endpoint (the 2Captcha Scraping Browser API) got through it on 2026-11-30. A run that cannot get through exits 3.
  • One page per ticker: the columns listed as always empty under "What it reads" are on other tabs of the site and are not fetched.
  • No rate limiting seen on the earlier payload.json route: on 2026-10-20 the whole S&P 500 (503 tickers) ran three times back to back from one home IP with Playwright, about 1,500 requests in 8 minutes, one ticker after another with no pause. Every run: 503 of 503, exit 0, no 403/429, 125–165 s each. Running several engines or machines in parallel was not tested.
  • Only the ticker's stock-analysis page. No screener/stock-list pages.
  • The consensus label is the site's own string, never mapped through a private lookup table.
  • Untested: non-USD tickers, and a - in a ticker symbol (a ., e.g. BRK.B, is confirmed live).
  • No local_e2e_test.py — see TESTING.md for why a single ticker fetch doesn't need one the way a paginated, proxy-rotating scraper does.

Examples

The Selenium and pyppeteer commands and every flag are under Install and run.

Verification

Date, commit Check Conditions Result
2026-12-02, 8203ad0 Quick start install a fresh virtualenv, Python 3.13, requirements-playwright.txt (Playwright 1.65.3) installs; every flag in the Quick start command is in --help
2026-12-02, 8203ad0 The Quick start command with no proxy a Hetzner datacentre address, no .env Cloudflare blocked AAPL and MSFT on all three attempts each: exit 3, nothing written — the documented outcome from a datacentre. Not re-run through the Scraping Browser in this pass (paid)
2026-12-02, 8203ad0 Offline suite smoke_test.py and .github/ci_checks.py, core requirements only passed
2026-12-01, 8203ad0 Canary, dispatched by hand after the route fix (#21) canary-live: a GitHub runner through a Scraping Browser endpoint. canary-datacentre: the runner's own IP canary-live green: 3 real ratings with every core field, exit 0. canary-datacentre: the runner refused (exit 3), as expected
2026-11-30 Access, after the route change a datacentre IP (curl, headless, headful); the Scraping Browser the datacentre IP got Cloudflare's managed challenge, which did not clear in 40 s; the Scraping Browser got HTTP 200 for AAPL and BRK.B and 404 for an unknown ticker
2026-11-23 and 2026-11-30 Canary, scheduled the code before #21 red: the live scrape ended exit 5 (remote_api_error) for all three tickers; the route was replaced in #21, merged 2026-12-01

What it reads

https://www.tipranks.com/stocks/{ticker}/stock-analysis. The site's server embeds the page's data in the HTML as the app's router state; the scraper reads that state from the page's own HTTP response — no CSS-selector/DOM scraping. Until November 2026 the page loaded its data from .../stock-analysis/payload.json; that endpoint now answers every ticker with HTTP 404, and earlier versions of this tool reported such a run as a genuine empty result (exit 4).

Per ticker:

  • smart_score, smart_score_updated — TipRanks' own 1-10 score.
  • consensus_rating_id / consensus_rating_label — the site's own Buy/Hold/Sell consensus label, verbatim in both (e.g. "Moderate Buy"; before November 2026 the id was camelCase, "moderateBuy").
  • analyst_count, buy_count, hold_count, sell_count.
  • price_target_average, price_target_upside (a fraction, e.g. -0.041 = -4.1%).
  • current_price, current_price_asof, current_price_source — the last session's price the page shows ("regular"). Not a real-time quote.
  • dividend_yield (a fraction), last_earnings_date, next_earnings_date.
  • company_name, currency, source_url, scraped_at.

These columns are still in every row but are now always empty: the stock-analysis page does not carry them, and the scraper fetches one page per ticker. price_target_high/_low and the best_* ("Best Performing Analysts") consensus are on the forecast tab; dividend amounts and dates, EPS figures and earnings time, and the insider / hedge fund / retail investor / news / blogger columns are on their own tabs. They keep their positions, so existing CSV consumers are not shifted.

Any of the consensus/count/price-target fields can be None — some tickers carry a price target with no buy/hold/sell breakdown at all, and some (confirmed live: GME) carry no analyst data at all — a real, observed shape, not a parser bug. See tipranks_parser.py's module docstring for exactly what's confirmed from a live capture versus what's explicitly out of scope.

Install and run

Pick one engine — all three produce identical output:

# Playwright (primary)
pip install -r requirements-playwright.txt
playwright install chromium
python3 playwright_scraper.py --ticker AAPL --ticker MSFT --format json --out results.json

# Selenium
pip install -r requirements-selenium.txt
python3 selenium_scraper.py --ticker AAPL --format json --out results.json

# Puppeteer (pyppeteer)
pip install -r requirements-puppeteer.txt
python3 puppeteer_scraper.py --ticker AAPL --format json --out results.json

Install each engine's requirements file in its own virtualenv — their pins are not all mutually satisfiable in one environment.

Flags, identical across all three:

Flag Meaning
--ticker SYM A ticker to scrape. Repeatable.
--tickers-file PATH One ticker per line, instead of repeating --ticker. Blank lines and # comments (whole-line or after a ticker) are skipped, as in --proxy-file.
--format json|csv Output format. Default json.
--out PATH Output file path. Default tipranks_results.json.
--allow-empty Write output even if every requested ticker came back empty.
--headed Launch a visible browser instead of headless (debugging).
--executable-path PATH Use an already-installed Chrome/Chromium instead of this engine's own bundled-browser download. Normally unnecessary — see Engine notes for the one confirmed case where it isn't.
--block-retries N On a blocked outcome, retry that ticker on the SAME browser/session this many extra times before giving up ("retry before you rotate"). Default 2; 0 means one fetch and no retry; a negative value is rejected (exit 2). At most one paid captcha solve is bought per ticker, however many retries, and only when a retry follows to use it.

2Captcha toolkit — opt-in, not required for a normal run

Added 2026-09-28, after a real Cloudflare block was observed in a pre-release audit (see "What's actually in front of the site" below). This repo has never observed an actual CAPTCHA widget — the one real block seen was a Cloudflare "Just a moment..." JS interstitial (a browser-fingerprinting challenge a real browser normally clears on its own), not a confirmed captcha-widget challenge. captcha_solver.py's detection/solving is family-standard plumbing, shipped for parity and in case that changes — it may simply find nothing to solve here. --proxy (a fresh exit IP) and --cdp-endpoint (a managed device identity) are this repo's own evidence-backed mitigations for the block actually observed.

--proxy --proxy-file --proxy-shuffle --cdp-endpoint --fingerprint --fp-tags --fp-country --twocaptcha-key --captcha-api --solve-captcha --min-score --scraper-api --scraper-api-timeout --scraper-api-url --scraper-api-cdp --scraper-api-country --scraper-api-profile-id

Identical across all three engines (smoke_test.py checks the flag sets and the --scraper-api-cdp wiring never drift apart), with two named, documented exceptions:

  • Selenium cannot authenticate a remote CDP session at all. --cdp-endpoint is refused outright (EXIT_BAD_USAGE) when it carries credentials — the shape of 2Captcha's own Scraping Browser API connection string — since chromedriver's debuggerAddress takes a bare host:port. Use playwright_scraper.py or puppeteer_scraper.py for that product. A bare, uncredentialed --cdp-endpoint (local remote debugging) still works on Selenium.
  • Selenium's --proxy-server cannot authenticate at all. A --proxy with a login/password has its credentials stripped before reaching Chrome, with a logged warning — not silently dropped.

--scraper-api sends one browserless HTTP call to 2Captcha's Scraper API (scraper.2captcha.com) instead of launching any local or --cdp-endpoint browser. Requires --twocaptcha-key/TWOCAPTCHA_KEY. It fetches the ticker page, like every browser engine (see "Engine notes"). Verified live on 2026-10-19, on the earlier payload.json route — see TESTING.md; not re-run on the page. --headed/--executable-path/--proxy/--cdp-endpoint/ --fingerprint are all ignored in this mode (logged as a warning, not silently dropped) — a single static fetch per ticker has no browser session and brings its own exit IP/device.

--scraper-api-cdp routes --scraper-api's fetch through your own 2Captcha Scraping Browser session (their cdpurl field) instead of their default pool. It needs that session's endpoint in --cdp-endpoint / TIPRANKS_CDP_ENDPOINT: the Scraping Browser has its own login and password, separate from the API key. --scraper-api-country and --scraper-api-profile-id replace the endpoint's -country-/-pid- parts. Verified live on 2026-10-19 (AAPL and MSFT, complete), on the earlier payload.json route.

Proxies: a run uses ONE proxy and does not rotate per ticker or on a block, since a per-ticker JSON fetch loop doesn't carry the volume that proxy rotation is built for. The exception is a dead proxy, one the browser cannot get through at all (ERR_PROXY_CONNECTION_FAILED and the like). Then the browser is relaunched on the next proxy in --proxy-file, the same ticker is fetched again, and a warning names both proxies (passwords masked). A dead proxy with nothing left to switch to fails its tickers as remote errors (exit 5) with a warning saying so, and the last proxy is never dropped, so the run keeps trying it. Any other fetch error is printed as Could not fetch TICKER: <reason>. Verified live on 2026-10-20 on all three engines: two dead proxies then a working one gave exit 0, including a switch to a password-protected proxy on Playwright and pyppeteer.

Proxy traffic savers. A proxy is billed by traffic, so a run through --proxy / --proxy-file / TIPRANKS_PROXY does three things to avoid paying for bytes it does not use:

  • One pre-check before any browser starts: a CONNECT through the proxy and a HEAD /robots.txt on www.tipranks.com, on the proxy the run is about to use. Chromium reports a proxy's HTTP 407 as a navigation timeout, so a wrong or exhausted credential used to look like a site failure. Now a 407 (the gateway refused the credential, or the traffic balance is exhausted) or a 402 (proxy traffic/balance exhausted) ends the run in seconds with exit 5 and <out>.latest_attempt.meta.json saying status: failed, stop_reason: proxy_auth_failed (or proxy_balance_exhausted). Any previous output and its .meta.json stay as they were. The message names TIPRANKS_PROXY and prints neither the login nor the password. A proxy that does not answer at all keeps the behaviour above (the browser makes its own attempt). No pre-check runs without a proxy or with --cdp-endpoint, which uses its own exit instead of the proxy.

  • Images, video/audio and web fonts are not downloaded through a local proxy: Playwright aborts them by resource type, pyppeteer through CDP's Fetch domain, Selenium by file extension with CDP Network.setBlockedURLs. The data comes from the page's HTML document alone. (The comparison measured on 2026-10-20 — the same rows and values with blocking on and off — was made on the earlier payload.json route and has not been repeated on the page.) --load-media (or TIPRANKS_LOAD_MEDIA=1) loads them. Without a proxy, or over --cdp-endpoint, nothing is blocked.

  • Every run is metered and capped: --proxy-budget-mb (default 10, 0 = no cap, also TIPRANKS_PROXY_BUDGET_MB). Once more than that has gone through the proxy, further requests are refused and the run stops before its next ticker. It keeps the ratings it has and exits 6 (or 5 with none), stop_reason: proxy_budget_exceeded; the tickers it did not reach are listed in failed_tickers. It never carries on past the cap. The sidecars (<out>.meta.json, and <out>.latest_attempt.meta.json, which every metered run writes) carry proxy_bytes, proxy_budget_bytes (null with no cap) and proxy_budget_exceeded, and the log ends with Proxy traffic: X.X MB of Y MB budget.

    How the bytes are counted: Playwright sums request.sizes() (request headers + body, response headers + body) of every finished or failed request; pyppeteer reads CDP Network.loadingFinished.encodedDataLength (bytes received, headers included) plus each request's line, headers and body from Network.requestWillBeSent; Selenium reads the same CDP events from chromedriver's performance log after each ticker. Only http(s) requests and responses that came over the network are counted: Chrome's own chrome://, data: and blob: loads, cache hits and Chrome's error page count nothing. The figure is an estimate of the payload through the tunnel: TLS, the CONNECT exchange and connections the browser opens for itself are not visible to the engines and add a few percent. Measured 2026-10-21 against a local stub proxy that counted every byte it carried (a 60 kB page, a 30 kB stylesheet, a 90 kB script): Playwright within 0.2%, pyppeteer 0.6%, Selenium 0.7%. A megabyte here is 10^6 bytes. Nothing is metered without a proxy, over --cdp-endpoint or with --scraper-api.

Credentials belong in .env / TIPRANKS_PROXY / TIPRANKS_CDP_ENDPOINT / TWOCAPTCHA_KEY — never as literal --proxy/--cdp-endpoint/ --twocaptcha-key text on a shared or logged command line if you can avoid it. See .env.example.

Output contract

Same exit codes across all three engines:

Exit Meaning
0 complete
1 crashed
2 bad usage (no tickers given, robots.txt disallows a path, ...)
3 blocked (a real 403/429, or the confirmed Cloudflare interstitial's own body/URL markers — see below)
4 zero results (every ticker answered with the site's own not-found page)
5 no rows obtained: navigation/network failure, a proxy that refused the credential or the balance before the run began (stop_reason: proxy_auth_failed / proxy_balance_exhausted in <out>.latest_attempt.meta.json), the proxy budget spent before any rating (stop_reason: proxy_budget_exceeded), or a served document that does not carry the ticker's data, such as the retired payload.json's 404 (status parser_failed)
6 partial (some tickers failed, others succeeded; or --proxy-budget-mb stopped the run, stop_reason: proxy_budget_exceeded)

A run where every requested ticker fails and none complete is 5 (remote API error) unless every one of those failures was specifically a 403/429, in which case it's 3 (blocked) — a total block and a total network outage are different situations for a caller (site actively rejected you vs. the network or engine itself broke), and both are distinct from 4, where the site was reachable and simply had nothing to return for a ticker (its own not-found page).

A zero-result run writes neither --out nor its .meta.json sidecar unless --allow-empty is passed, so it does not overwrite a previous good result by default. Output and sidecar are replaced atomically and new sidecars carry an output checksum that diff_runs.py verifies. An unknown ticker is recorded as a completed ticker that contributed zero rows, not a failure — but only when the site answers with its own not-found page (HTTP 404 whose page state marks that ticker's route notFound). Any other answer without the ticker's data — a 404/400 that is not that page, a page whose state no longer has the ticker — is a parser failure: the ticker counts as failed and is listed under parser_failed_tickers in the sidecar, so a route or page-shape change is never reported as "this ticker does not exist". CSV output prefixes text cells that start with =, +, -, @, a tab or a line break with ' so a spreadsheet does not run them as formulas (JSON is never altered); the sidecar's csv_cells_escaped counts them. New output files get the permissions your umask allows; an existing file keeps its mode.

diff_runs.py old.json new.json compares two completed runs: added / removed tickers, and per-ticker rating / price-target / Smart Score changes.

robots.txt

https://www.tipranks.com/robots.txt disallows /api/* and a handful of other paths, but not /stocks/* (aside from /stocks/*/options-chain/*, unrelated to this repo). tipranks_parser.is_allowed() re-checks this from the captured robots.txt text itself at runtime, not from a hardcoded conclusion.

What's actually in front of the site

Two edge layers, confirmed from real response headers: Fastly (caching, observed 2026-09/10) sitting with Cloudflare (server: cloudflare, cf-ray).

Since November 2026 (measured 2026-11-30): the ticker page answers a datacentre IP — curl, headless and headful Chromium alike — with Cloudflare's managed challenge (HTTP 403 "Just a moment...", Turnstile), which did not clear within 40 s. Through the 2Captcha Scraping Browser API (--cdp-endpoint) it answered 200 on the first navigation (AAPL, BRK.B) and 404 for an unknown ticker. A local run without a proxy is therefore expected to exit 3 from a datacentre; from a home connection it was not re-measured. Every engine gives a challenge 20 s to clear itself before it reports the ticker blocked. The history below predates this change.

On the challenge side: Cloudflare's bot-management fingerprinting script loads on every page view, and Google reCAPTCHA's script is also present on the page (loaded, not auto-rendered). Neither ever actually challenged a request in this project's research — roughly 20 distinct tickers and 35+ requests, all clean 200s, no CAPTCHA, no 429. No DataDome/PerimeterX/Akamai/Imperva/Kasada/Arkose Labs signature was found either. That's "not observed to challenge this traffic," not "confirmed unprotected" — there's no known solvable challenge to wire up here because none was presented in that research session. A later audit did observe a real one: an HTTP 403 Cloudflare JS challenge ("Just a moment...", a __cf_chl_rt_tk token on the final URL) on the page navigation, in a local headless Playwright run, after an earlier run from the same environment had already completed successfully — a behavior- triggered challenge, not a first-request block. The scraper reports that as exit 3. GitHub Actions' own datacentre IPs are refused the same way: every scheduled canary run from 2026-10-01 to 2026-10-15 ended blocked with 0 rows. The canary's canary-live job therefore runs through a different exit, weekly (Mondays) and on a manual dispatch, and is red unless it collects real, fully parsed rows. It picks the exit in this order:

  1. A fresh Scraping Browser endpoint. This needs the TWOCAPTCHA_KEY secret and the TIPRANKS_BROWSER_ACCOUNT_ID repository variable. tools/browser_endpoint.py takes that browser account's current connectionUri from GET https://api.2captcha.com/browser/accounts right before the run. It prefers the profile's URI over the account's own.
  2. The TIPRANKS_CDP_ENDPOINT secret (a stored connection string).
  3. The TIPRANKS_PROXY secret.

A stored connection string does not last: the one in the secret was accepted on 2026-10-19 and 2026-10-20 and refused with 401 deny_no_user on 2026-10-21.

The job fails with an error naming what is missing in two cases:

  • none of the three is set;
  • the fresh fetch was configured but failed, and there is no stored endpoint to fall back on.

A separate canary-datacentre job keeps trying the runner's own IP and reports the expected refusal as a notice.

tools/browser_endpoint.py works locally too:

python3 tools/browser_endpoint.py --account-id 1581

It reads TWOCAPTCHA_KEY from the environment or .env, never from argv. It writes TIPRANKS_CDP_ENDPOINT into .env (mode 0600) and prints only the scheme, host and port of the URI. The API takes the key in the query string, so every error message is redacted. On an HTTP error it prints the API's own errorCode.

Engine notes

  • Every engine opens the ticker page and reads the router state from the page document's HTTP body: the page's own script removes it from the DOM after running, so the rendered DOM never has it. All three hand the document to the same tipranks_parser.read_ticker_page().
  • Playwright / Puppeteer read the document's status and body from the navigation response (the second document, if a challenge clears itself and reloads). Both are also the only two engines that can open an authenticated --cdp-endpoint session (e.g. the 2Captcha Scraping Browser API) and arm its own Captcha.setAutoSolve CDP domain.
  • Selenium: chromedriver exposes neither the status nor the body, so selenium_scraper.py waits for the challenge markers to go away, then re-reads the document with an in-page fetch(location.href, {cache: "force-cache"}): a second request for the page unless Chrome's cache answers it (in a local test with a self-signed certificate it did not, so count on two). --cdp-endpoint is refused outright when it carries credentials — see "2Captcha toolkit" above.
  • Puppeteer (legacy/experimental): pyppeteer is effectively unmaintained. Confirmed live on a real Apple Silicon Mac — pyppeteer's own bundled Chromium download (pinned at revision 117.0.5938.0) launches but then segfaults on an actual headless run. Playwright's and Selenium's own browser/driver downloads were unaffected on the same machine, so this is specific to that one pinned build, not this site or this repo's code. On Apple Silicon the engine now finds Google Chrome or Chromium in /Applications or ~/Applications and uses it on its own (logged at INFO). The bundled build is still tried when neither is installed, and on every other platform, including the Docker image. --executable-path /path/to/Chrome overrides the search (all three engines accept this flag, for CLI parity, though only Puppeteer has needed it so far).

Testing

python3 smoke_test.py — offline, no browser required, runs against real captured fixtures in tests/fixtures/, and against all three engines with no driver installed. See TESTING.md for the full coverage list and the live-testing checklist.

FAQ

Does TipRanks have a public API?

This repository does not use one. It reads the router state the server embeds in the ticker's stock-analysis page HTML, from the page's own HTTP response. robots.txt disallows /api/*, and the scraper stays off it; it re-checks the captured robots.txt at run time. See What it reads.

Is there a TipRanks scraper API?

No hosted API: this is a command-line tool you run yourself, and one command writes the rows to JSON or CSV with a .meta.json file beside them that records whether the run completed. To run it on a schedule, put the Quick start command in cron or a CI job.

Is it legal to scrape tipranks.com?

This is not legal advice. Scraping public pages is permitted in many jurisdictions, but TipRanks' terms of use, copyright in its ratings and data-protection law differ between countries. The tool reads one public page per ticker without an account, and keeps off the paths robots.txt disallows. Keep the request rate low and do not collect personal data without a lawful basis.

Why does TipRanks block headless browsers or datacenter IPs?

Since November 2026 the ticker page answers a datacentre IP with Cloudflare's managed challenge (HTTP 403, "Just a moment..."), and it did not clear within 40 s — for curl, headless and headful Chromium alike (2026-11-30), so the address decides rather than the browser. Through the 2Captcha Scraping Browser API it answered on the first navigation. A run that cannot get through exits 3, never 4.

How do I run the TipRanks scraper on a server?

Put a Scraping Browser API endpoint in TIPRANKS_CDP_ENDPOINT in .env and run the Quick start command with Playwright or pyppeteer (Selenium cannot authenticate one). A stored endpoint does not last: tools/browser_endpoint.py fetches a fresh one from your 2Captcha account right before a run, which is what the canary does. Branch on the exit code and on status in the .meta.json.

What fields does the scraper return?

One row per ticker: smart_score, consensus_rating_id and _label, analyst_count, buy_count, hold_count, sell_count, price_target_average, price_target_upside, current_price and its date, dividend_yield, last_earnings_date, next_earnings_date, company_name and currency. Columns from the site's other tabs are kept in place but empty. See What it reads.

How often does it break when tipranks.com changes?

It broke in November 2026, when the payload.json endpoint it read began answering HTTP 404 for every ticker; the scraper now reads the ticker page itself (fixed 2026-12-01). The weekly canary runs three tickers through a Scraping Browser endpoint and was green on 2026-12-01. Fixes are recorded in CHANGELOG.md.

Related scrapers

Same CLI conventions, same output contract (one row per item, JSON or CSV, a .meta.json sidecar and shared exit codes):

All scrapers: github.com/2scraper · Need another site? Open a request

Releases

Packages

Contributors

Languages