Sub topic 6
Using web archives to see what the dead page covered
This chapter assumes you can already find a broken outbound link on a target page and read its HTTP status code. It also assumes you can read basic Python. The previous chapters covered how to detect the 404. This one covers the next step: finding out what the dead page said, so you can offer a replacement that fits.
Why recover the old content
A link that points to a dead page was placed for a reason. The site owner thought that page answered a question for their readers. If you offer a replacement that answers a different question, the owner has no reason to swap it in.
An archived copy of the dead page gives you three things:
- Topic and scope. You see what the page covered and how deep it went.
- Format. You learn whether it was a glossary, a tutorial, a statistics roundup, a tool or a template.
- Fit with the linking page. You can compare the old page's claims with the sentence that links to it, and check that your page supports that sentence.
Without this step you are guessing from the anchor text and the URL slug. Slugs are often vague, and anchor text such as "this guide" says almost nothing.
Where archived copies live
The Internet Archive's Wayback Machine is the main source. It stores timestamped captures of public pages. Other places can help when the Wayback Machine has nothing:
| Source | What it offers | Limits |
|---|---|---|
| Wayback Machine | Many dated captures per URL, with HTML and often images | Some pages are excluded or never captured |
| Search engine cache links | Sometimes a recent copy | Mostly retired, so do not rely on it |
| archive.today | User-submitted captures | Only exists if someone saved that page |
| Your own SEO tool | Stored titles, headings and backlink data for the URL | Gives metadata, not the full text |
You can also look at who linked to the dead URL. The anchor texts used by other sites often describe the page better than its slug does.
Reading the Wayback Machine by hand
The simplest route is to open https://web.archive.org/web/*/https://example.com/old-guide. The page shows a calendar of captures. Blue and green dots mark captures that returned a success or redirect status. Orange and red dots mark client and server errors.
Pick a capture with these rules:
- Choose a capture from when the page was alive, ideally from the period close to when the linking site added the link.
- Compare two or three captures across the years. Pages change, and the newest capture is often a "page moved" notice or a thin placeholder.
- Read the capture itself, not only its title. Note the headings, the main claims and any data it cited.
Querying captures with the CDX API
For more than a handful of URLs, use the Wayback Machine's CDX API. It returns one row per capture. Useful fields are timestamp, statuscode and digest. The digest is a hash of the content, so two captures with the same digest hold identical content. Setting collapse=digest drops those duplicates.
To fetch the page without the Wayback toolbar and rewritten links, insert id_ after the timestamp in the capture URL. For example: https://web.archive.org/web/20200315000000id_/https://example.com/old-guide.
The script below follows that flow. It lists 200-status captures, walks backward from the newest one, skips captures with very little text, and summarizes the first real capture it finds.
import requests
from bs4 import BeautifulSoup
CDX = "https://web.archive.org/cdx/search/cdx"
HEADERS = {"User-Agent": "link-audit/1.0"}
MIN_WORDS = 150
def list_snapshots(url, timeout=30):
params = {
"url": url,
"output": "json",
"fl": "timestamp,statuscode,digest",
"filter": "statuscode:200",
"collapse": "digest",
}
resp = requests.get(CDX, params=params, headers=HEADERS, timeout=timeout)
resp.raise_for_status()
if not resp.text.strip():
return []
rows = resp.json()
# The first row is the header; the rest are oldest to newest.
return [{"timestamp": r[0], "statuscode": r[1], "digest": r[2]} for r in rows[1:]]
def summarize_capture(url, timestamp, timeout=30):
raw_url = f"https://web.archive.org/web/{timestamp}id_/{url}"
resp = requests.get(raw_url, headers=HEADERS, timeout=timeout)
resp.raise_for_status()
soup = BeautifulSoup(resp.text, "html.parser")
for tag in soup(["script", "style", "nav", "footer"]):
tag.decompose()
title = soup.title.get_text(strip=True) if soup.title else ""
headings = [h.get_text(" ", strip=True) for h in soup.find_all(["h1", "h2", "h3"])]
words = len(soup.get_text(" ").split())
return {"timestamp": timestamp, "title": title, "headings": headings, "words": words}
def recover(url, max_tries=5):
snapshots = list_snapshots(url)
for snap in reversed(snapshots[-max_tries:]):
summary = summarize_capture(url, snap["timestamp"])
if summary["words"] >= MIN_WORDS:
return summary
return None
if __name__ == "__main__":
result = recover("https://example.com/old-guide")
if result is None:
print("No usable capture found")
else:
print(result["timestamp"], result["title"], result["words"])
for heading in result["headings"]:
print(" -", heading)The word-count check is a rough filter. A capture of a "this page has moved" notice can return status 200 and still hold almost no text. Treat any result as a lead you confirm by opening the capture in a browser.
What to record
Write a short brief for each dead URL. Keep it to a few lines:
- Capture date and the capture URL you used.
- Title and the list of headings.
- Content type: guide, list, statistics page, tool, template, definition.
- Approximate length and whether it had data, images or downloads.
- Any date-bound claims, such as "2019 survey results".
- The sentence on the linking page that contains the link.
This brief drives the next chapter. You compare it against your existing pages to see whether one already matches, or whether you need to write something new.
Edge cases and failure modes
No captures at all. Small or new sites are often not archived. Look at the anchor text other sites used for that URL, the linking page's surrounding sentence, and a search for the page's likely title. If you still cannot tell what it covered, the prospect is weak. Skip it rather than guessing.
Captures that are redirects. The CDX API reports 301 and 302 rows separately. If the dead URL once redirected to another page, the redirect target tells you where the owner moved the content. Check whether that target is still live. If it is, the link may not be broken after all, or it may be a soft 404 you handled earlier.
Soft 404 captures. A page that said "not found" but returned 200 gets stored as a 200 capture. The word-count check catches many of these, but not all. Read the text.
JavaScript-rendered pages. If the original page built its content in the browser, the archived HTML may be an empty shell. The headings and word count will look wrong. Open the capture in a browser to see whether the archive replayed the scripts.
Excluded pages. Site owners can ask the Internet Archive to exclude their pages, and the archive may not show captures that were blocked at the time. An empty result does not prove the page never existed.
Rate limits. The Wayback endpoints throttle heavy use. Send a descriptive User-Agent, add a short pause between requests, and cache results so you never fetch the same URL twice.
Putting it into the process
At this point in the workflow you have a list of dead URLs with their linking pages. For each one:
- Run the lookup and save the capture URL and summary.
- Drop prospects where you cannot establish what the page covered.
- Note the content type and the claim the link supports.
- Pass the brief to the replacement step.
Archived pages can also be useful in outreach. You can mention what the dead page used to cover. This shows you checked the link and understood its purpose. Keep it to one sentence, since the site owner cares about the fix, not about your research.
Exercise
A CDX query for a dead URL returns three 200-status captures. The newest has 40 words of text and the heading "This page has moved". The second has 1,800 words with eight headings about email deliverability. What should you do next, and what should you avoid doing with the second capture?
Show answer
Treat the newest capture as a placeholder (a soft 404 or a moved notice) and use the second capture as the basis for your brief. Record its date, title, headings and content type, and open it in a browser to confirm it renders properly. Avoid copying its text or images into your replacement page, because that is another author's content. Use it only to learn the topic, depth and format that your replacement should match.