File size: 18,576 Bytes
81dba07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7301cf
81dba07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7301cf
 
 
81dba07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7301cf
81dba07
 
 
 
 
 
 
 
 
 
ac71aa1
81dba07
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
"""Rebuild this repository from the live study at https://scraperfinder.com/what-it-takes/.

    python3 scripts/build.py            # charts + README from the files in data/
    python3 scripts/build.py --fetch    # download the current CSV + JSON first

Standard library only. The numbers in README.md and charts/ are computed from data/, never typed by hand.
"""
import csv
import io
import json
import math
import statistics
import sys
import urllib.request
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
DATA = ROOT / "data"
CHARTS = ROOT / "charts"
SITE = "https://scraperfinder.com"
STUDY = SITE + "/what-it-takes/"
FILES = ("what-it-takes.json", "what-it-takes.csv")
REPO = "web-data-access-study"

SURFACE, INK, INK2, MUTED, GRID, BAR, BAR2 = "#fcfcfb", "#0b0b0b", "#52514e", "#8a8984", "#e6e5e0", "#2a78d6", "#eb6834"
FONT = "Helvetica, Arial, sans-serif"


def fetch():
    DATA.mkdir(exist_ok=True)
    for name in FILES:
        req = urllib.request.Request(f"{SITE}/data/{name}", headers={"User-Agent": "web-data-access-study-repo/1.0"})
        body = urllib.request.urlopen(req, timeout=60).read()
        if name.endswith(".json"):
            json.loads(body)  # refuse a broken download
        else:
            rows = list(csv.reader(io.StringIO(body.decode("utf-8-sig"))))
            if len(rows) < 100:
                raise SystemExit(f"{name}: only {len(rows)} rows, refusing")
        (DATA / name).write_bytes(body)


def esc(s):
    return str(s).replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;")


def text_w(s, size):
    """Rough rendered width of Helvetica/Arial text (enough to keep labels from colliding)."""
    narrow = sum(1 for ch in s if ch in "il.,:;'|!()[] ")
    wide = sum(1 for ch in s if ch in "MWmw@%")
    return size * (0.56 * (len(s) - narrow - wide) + 0.3 * narrow + 0.85 * wide)


def n(x):
    return f"{x:,}"


def bar_chart(path, title, subtitle, rows, source, xmax=100):
    """Horizontal bars, one series, 0-xmax%. rows: (label, pct, note)."""
    label_w = max(text_w(r[0], 13) for r in rows) + 16
    note_w = max(text_w(r[2], 12) for r in rows) + 60
    plot_w = 520
    W = int(24 + label_w + plot_w + note_w + 24)
    row_h, bar_h, top = 24, 16, 96
    H = top + row_h * len(rows) + 64
    x0 = 24 + label_w
    out = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="{H}" viewBox="0 0 {W} {H}" font-family="{FONT}">',
           f'<rect width="{W}" height="{H}" fill="{SURFACE}"/>',
           f'<text x="24" y="38" font-size="20" font-weight="700" fill="{INK}">{esc(title)}</text>',
           f'<text x="24" y="62" font-size="13" fill="{INK2}">{esc(subtitle)}</text>']
    step = 25 if xmax > 60 else 10
    for t in range(0, xmax + 1, step):
        x = x0 + plot_w * t / xmax
        out.append(f'<line x1="{x:.1f}" y1="{top - 8}" x2="{x:.1f}" y2="{top + row_h * len(rows)}" stroke="{GRID}" stroke-width="1"/>')
        out.append(f'<text x="{x:.1f}" y="{top - 14}" font-size="11" fill="{MUTED}" text-anchor="middle">{t}%</text>')
    for i, (label, pct, note) in enumerate(rows):
        y = top + i * row_h + (row_h - bar_h) / 2
        w = max(plot_w * min(pct, xmax) / xmax, 2)
        r = min(4, w / 2)
        out.append(f'<text x="{x0 - 10:.1f}" y="{y + bar_h - 4:.1f}" font-size="13" fill="{INK}" text-anchor="end">{esc(label)}</text>')
        # square at the baseline, 4px rounded data end
        out.append(f'<path d="M{x0:.1f},{y:.1f} h{w - r:.1f} a{r},{r} 0 0 1 {r},{r} v{bar_h - 2 * r:.1f} a{r},{r} 0 0 1 -{r},{r} h-{w - r:.1f} z" fill="{BAR}"/>')
        out.append(f'<text x="{x0 + w + 8:.1f}" y="{y + bar_h - 4:.1f}" font-size="13" font-weight="700" fill="{INK}" stroke="{SURFACE}" stroke-width="4" paint-order="stroke">{pct}%</text>')
        out.append(f'<text x="{x0 + w + 46:.1f}" y="{y + bar_h - 4:.1f}" font-size="12" fill="{MUTED}" stroke="{SURFACE}" stroke-width="4" paint-order="stroke">{esc(note)}</text>')
    out.append(f'<text x="24" y="{H - 24}" font-size="11" fill="{MUTED}">{esc(source)}</text>')
    out.append("</svg>")
    path.write_text("\n".join(out) + "\n", encoding="utf-8", newline="\n")


def scatter(path, title, subtitle, pts, xlab, ylab, source, label_names):
    """pts: (name, x_pct, y_pct, size). Both axes 0-100; labels only for label_names."""
    W, H, L, R, T, B = 760, 640, 76, 40, 96, 92
    pw, ph = W - L - R, H - T - B
    lo = 20

    def sx(v):
        return L + pw * (v - lo) / (100 - lo)

    def sy(v):
        return T + ph * (1 - (v - lo) / (100 - lo))
    out = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="{H}" viewBox="0 0 {W} {H}" font-family="{FONT}">',
           f'<rect width="{W}" height="{H}" fill="{SURFACE}"/>',
           f'<text x="24" y="38" font-size="20" font-weight="700" fill="{INK}">{esc(title)}</text>',
           f'<text x="24" y="62" font-size="13" fill="{INK2}">{esc(subtitle)}</text>']
    for t in range(lo, 101, 20):
        out.append(f'<line x1="{sx(t):.1f}" y1="{T}" x2="{sx(t):.1f}" y2="{T + ph}" stroke="{GRID}"/>')
        out.append(f'<line x1="{L}" y1="{sy(t):.1f}" x2="{L + pw}" y2="{sy(t):.1f}" stroke="{GRID}"/>')
        out.append(f'<text x="{sx(t):.1f}" y="{T + ph + 18}" font-size="11" fill="{MUTED}" text-anchor="middle">{t}%</text>')
        out.append(f'<text x="{L - 8}" y="{sy(t) + 4:.1f}" font-size="11" fill="{MUTED}" text-anchor="end">{t}%</text>')
    out.append(f'<text x="{L + pw / 2:.1f}" y="{T + ph + 44}" font-size="13" fill="{INK2}" text-anchor="middle">{esc(xlab)}</text>')
    out.append(f'<text transform="translate(22,{T + ph / 2:.1f}) rotate(-90)" font-size="13" fill="{INK2}" text-anchor="middle">{esc(ylab)}</text>')
    smax = max(p[3] for p in pts)
    for name, x, y, size in sorted(pts, key=lambda p: -p[3]):
        r = 4 + 10 * math.sqrt(size / smax)
        out.append(f'<circle cx="{sx(x):.1f}" cy="{sy(y):.1f}" r="{r:.1f}" fill="{BAR}" fill-opacity="0.55" stroke="{SURFACE}" stroke-width="2"><title>{esc(name)}: {x}% / {y}%</title></circle>')
    placed = []  # label boxes (x0, y0, x1, y1); a label that would touch another one is dropped, never stacked
    for name, x, y, size in sorted(pts, key=lambda p: -p[3]):
        if name not in label_names:
            continue
        r = 4 + 10 * math.sqrt(size / smax)
        w = text_w(name, 12)
        cx, cy = sx(x), sy(y)
        for anchor, tx, ty in (("start", cx + r + 4, cy + 4), ("end", cx - r - 4, cy + 4),
                               ("middle", cx, cy - r - 5), ("middle", cx, cy + r + 14)):
            x0 = tx if anchor == "start" else tx - w if anchor == "end" else tx - w / 2
            box = (x0 - 2, ty - 12, x0 + w + 2, ty + 3)
            if box[0] > L and box[2] < L + pw and not any(overlap(box, b) for b in placed):
                placed.append(box)
                out.append(f'<text x="{tx:.1f}" y="{ty:.1f}" font-size="12" fill="{INK}" text-anchor="{anchor}">{esc(name)}</text>')
                break
    out.append(f'<text x="24" y="{H - 20}" font-size="11" fill="{MUTED}">{esc(source)}</text>')
    out.append("</svg>")
    path.write_text("\n".join(out) + "\n", encoding="utf-8", newline="\n")


def overlap(a, b):
    return a[0] < b[2] and b[0] < a[2] and a[1] < b[3] and b[1] < a[3]


def gate_text(path):
    """Build gate: no two text labels in a chart may overlap, and none may leave the canvas."""
    import re
    svg = path.read_text(encoding="utf-8")
    W = float(re.search(r'width="([\d.]+)"', svg).group(1))
    boxes = []
    for m in re.finditer(r'<text x="([\d.-]+)" y="([\d.-]+)" font-size="(\d+)"([^>]*)>([^<]*)</text>', svg):
        x, y, size, txt = float(m[1]), float(m[2]), int(m[3]), m[5]
        a = re.search(r'text-anchor="(\w+)"', m[4])
        anchor = a.group(1) if a else "start"
        w = text_w(txt.replace("&amp;", "&"), size)
        x0 = x if anchor == "start" else x - w if anchor == "end" else x - w / 2
        box = (x0, y - size * 0.8, x0 + w, y + size * 0.2, txt)
        if box[0] < 0 or box[2] > W:
            raise SystemExit(f"{path.name}: label {txt!r} leaves the canvas")
        for b in boxes:
            if overlap(box, b):
                raise SystemExit(f"{path.name}: labels {txt!r} and {b[4]!r} overlap")
        boxes.append(box)


def human_date(iso):
    y, m, d = iso.split("-")
    months = "January February March April May June July August September October November December".split()
    return f"{int(d)} {months[int(m) - 1]} {y}"


def pct(a, b):
    return round(100 * a / b) if b else 0


def build():
    d = json.loads((DATA / FILES[0]).read_text(encoding="utf-8"))
    rows = list(csv.DictReader(io.StringIO((DATA / FILES[1]).read_text(encoding="utf-8-sig"))))
    t = d["totals"]
    recs = d["rows"]
    N = t["websites"]
    upd = human_date(d["updated"])
    span = f"{human_date(d['checkedFrom'])} to {human_date(d['checkedTo'])}"
    src = f"Source: Scraper Finder, scraperfinder.com/what-it-takes (CC BY 4.0), facts read {span}."
    CHARTS.mkdir(exist_ok=True)

    api_names = [("public", "Public API"), ("limited", "Limited access"), ("partner", "Partner only"),
                 ("none", "No API"), ("retired", "Retired")]
    api_count = {k: sum(1 for r in recs if r["api"] == k) for k, _ in api_names}
    bar_chart(CHARTS / "official-api.svg",
              f"Does the website offer an official API? {N} major websites",
              "Public: anyone can sign up. Limited: approval, a paid tier or a narrow scope. Partner: contracts only.",
              [(label, pct(api_count[k], N), f"{api_count[k]} websites") for k, label in api_names], src, xmax=50)

    def refused(r):
        return (r.get("robots") or {}).get("answer") == "refused" or (r.get("terms") or {}).get("answer") == "refused"
    by_api = []
    for k, label in api_names:
        grp = [r for r in recs if r["api"] == k]
        if len(grp) >= 20:  # groups under 20 websites are too small to compare
            by_api.append((label, len(grp), sum(1 for r in grp if refused(r))))
    bar_chart(CHARTS / "refused-by-api.svg",
              "Websites without an open API screen scripts more often",
              "Share that refused one plain HTTPS request for robots.txt or the terms page (403, 429 ...), by official API status.",
              [(label, pct(x, g), f"{x} of {g} websites") for label, g, x in by_api], src, xmax=60)

    read = t["robotsRead"]
    ai = d["aiCrawlers"][:16]
    bar_chart(CHARTS / "ai-crawlers-named.svg",
              "AI crawlers named in robots.txt",
              f"Of the {read} websites whose robots.txt could be read, the share whose file gives each AI crawler its own rules.",
              [(a["name"], pct(a["websites"], read), f"{a['websites']} of {read}") for a in ai], src, xmax=50)

    for svg in CHARTS.glob("*.svg"):
        gate_text(svg)

    pub = next(x for x in by_api if x[0] == "Public API")
    non = next(x for x in by_api if x[0] == "No API")
    rob_ref = t["robotsRefused"]
    rob_403 = sum(1 for r in recs if (r.get("robots") or {}).get("answer") == "refused" and (r["robots"].get("status") == 403))
    names = [set((r.get("robots") or {}).get("aiCrawlersNamed") or []) for r in recs]
    gpt_only = sum(1 for x in names if "GPTBot" in x and "ClaudeBot" not in x)
    claude_only = sum(1 for x in names if "ClaudeBot" in x and "GPTBot" not in x)
    most = max(zip(names, recs), key=lambda z: (len(z[0]), z[1]["name"]))
    blocks_all = sorted((r["name"] for r in recs if (r.get("robots") or {}).get("rule") == "all"), key=str.lower)
    closed = [c["name"] for c in d["closedBoth"]]
    cat_rows = "\n".join(
        f"| {c['name']} | {c['websites']} | {c['apiPublic']} | {c['apiNone']} | {c['robotsBlocksAll']} | {c['plainRefusedEither']} | {c['robotsNamesAi']} |"
        for c in d["byCategory"])
    ratio = (non[2] / non[1]) / (pub[2] / pub[1]) if pub[2] else 0
    header = list(rows[0].keys())

    readme = f"""# What it takes to get data from {N} major websites

For each of {N} websites people commonly want data from (Amazon, LinkedIn, Zillow, Indeed, Google Maps and the
rest), this dataset records whether there is an official API anyone can use, what its robots.txt says to crawlers,
which AI crawlers it names, and whether it answered one plain HTTPS request for two public files. Facts read
{span}; last change {upd}.

It is the data behind **[scraperfinder.com/what-it-takes](https://scraperfinder.com/what-it-takes/)**, released under
CC BY 4.0 with the script that draws the charts below.

## The short version

- **{api_count['public']} of {N} ({pct(api_count['public'], N)}%) offer a public official API.** The rest limit theirs to approved
  uses ({api_count['limited']}), keep it for partners ({api_count['partner']}), have none ({api_count['none']}) or retired it ({api_count['retired']}).
- **{t['plainRefusedEither']} ({t['plainRefusedEitherPct']}%) refused a plain request** for their robots.txt or their terms page.
  {rob_ref} of them refused the robots.txt itself, {rob_403} with a 403: the file written for robots, withheld from a robot.
- **For {t['robotsBlocksAll']} websites, robots.txt disallows every path** for crawlers without their own rules: {", ".join(blocks_all)}.
- **For {t['robotsNamesAi']} of the {read} websites whose robots.txt was read, it names AI crawlers.** GPTBot ({ai[0]['websites']}) and ClaudeBot ({next(a['websites'] for a in d['aiCrawlers'] if a['name'] == 'ClaudeBot')}) are named most;
  {gpt_only} name GPTBot but not ClaudeBot, {claude_only} the reverse. {most[1]['name']} names the most: {len(most[0])}.
- **{len(closed)} websites have no public API and a robots.txt that disallows every path:** {", ".join(closed)}.

![Official API status of {N} major websites](charts/official-api.svg)

## Websites without an open API screen scripts more often

Split by API status, the websites with no API at all refused the plain request {non[2]} times out of {non[1]}
({pct(non[2], non[1])}%), against {pub[2]} of {pub[1]} ({pct(pub[2], pub[1])}%) for websites with a public API: {ratio:.1f} times the rate.
The groups are small and the request is a single one, so read it as a tendency, not a law. It fits what anyone who
has tried to collect data has seen: the websites that offer no front door are also the ones guarding the side door.

![Share of websites refusing a plain request, by official API status](charts/refused-by-api.svg)

## Who names AI crawlers

![AI crawlers named in robots.txt](charts/ai-crawlers-named.svg)

Naming a crawler usually means keeping it out, but not always: some files name one only to allow it or to slow it
down. The per-website pages quote the actual rules.

## By kind of website

| Kind of website | Websites | Public API | No API | robots.txt disallows every path | Refused a plain request | Name AI crawlers |
|---|---:|---:|---:|---:|---:|---:|
{cat_rows}

"Other" groups kinds with fewer than four websites.

## Files

| File | What it holds |
|---|---|
| [`data/what-it-takes.csv`](data/what-it-takes.csv) | one row per website: {", ".join(f"`{h}`" for h in header)} |
| [`data/what-it-takes.json`](data/what-it-takes.json) | the same facts per website with their source URLs, plus totals, AI-crawler counts and the per-kind table |
| [`charts/`](charts) | the charts on this page, as SVG |
| [`scripts/build.py`](scripts/build.py) | downloads the current files (`--fetch`) and rebuilds the charts and this README; standard-library Python |

## Method

- **Official API:** the website's own developer documentation and pricing pages, each source dated. Public means
  anyone can sign up and call it; limited means approval, a paid tier or a narrow scope; partner means contracts only.
- **robots.txt:** fetched from the website (or its www host) with one HTTPS request a week. The rules counted are the
  ones under `User-agent: *`; an AI crawler counts when a group names it.
- **Plain request:** the HTTP status of that robots.txt request and of one request for the terms page, sent with an
  ordinary browser user-agent string but no browser, no cookies and no retries. 404 counts as not found, a timeout as
  no answer, any other 4xx or 5xx as refused.
- **Court cases:** a curated list of decided or settled cases about collecting that website's data, each with a source.
- **Open-source scrapers:** public GitHub repositories whose name carries the website and whose description says they
  scrape, crawl, download or export it; archived ones are left out.

## What this does not measure

Whether a page needs a real browser, shows CAPTCHAs, rate-limits, sits behind a login or blocks IP ranges. One plain
request answers none of that, and nothing was sent to these websites beyond those two files. A refusal says the
website screens automated traffic at its front door; an answer says nothing about its search or product pages.
robots.txt is a crawling convention and the terms page is the contract. This is general information, not legal advice.

## Licence and credit

[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (see [`LICENSE`](LICENSE)): reuse it for anything, with a
credit and a link to https://scraperfinder.com/what-it-takes/

> Scraper Finder (2026). What it takes to get data from {N} major websites: official APIs, robots.txt rules and
> plain-request answers. Updated {upd}. https://scraperfinder.com/what-it-takes/

Published by [Scraper Finder](https://scraperfinder.com), which maps the routes to each website's data (official API,
hosted tools, open source). The robots.txt files, terms pages and repositories are read again every week and this
copy follows the study. Spotted a wrong fact? Say so on the dataset's discussion page, with the source.
"""
    (ROOT / "README.md").write_text(readme, encoding="utf-8", newline="\n")
    cff = f"""cff-version: 1.2.0
message: "If you use this data, please cite it."
title: "What it takes to get data from {N} major websites: official APIs, robots.txt rules and plain-request answers"
type: dataset
authors:
  - name: "Scraper Finder"
    website: "https://scraperfinder.com"
url: "https://scraperfinder.com/what-it-takes/"
doi: "10.5281/zenodo.24197676"
license: CC-BY-4.0
date-released: "{d['updated']}"
keywords: [robots.txt, web scraping, APIs, AI crawlers, GPTBot, open data]
"""
    (ROOT / "CITATION.cff").write_text(cff, encoding="utf-8", newline="\n")
    print(f"built: {len(rows)} rows, {N} websites, updated {d['updated']}, refused none/public {non[2]}/{non[1]} vs {pub[2]}/{pub[1]}")


if __name__ == "__main__":
    if "--fetch" in sys.argv:
        fetch()
    build()