To find a web page's publication date, look for a clearly labeled publication claim, then compare it with the date metadata for the same article. Keep the original value and its source. A modification date, an HTTP response date, and the time your agent retrieved the page describe different events. If the page supplies no attributable publication date, record it as unknown; if its publication claims disagree, preserve the conflict. The workflow below inventories a real page, checks its readable context, and produces a date record without silently choosing the newest timestamp.
Decide which event you need to date
An agent answering “Was this article published recently?” needs a different field from an agent answering “Has this page changed?” Give those questions separate slots in the source record before parsing anything.
Schema.org defines datePublished as the date of first publication or broadcast. On an article, that is the publisher's claim about the article's origin. dateModified describes a later modification. Neither field becomes independently verified merely because its value parses as a date.
| Signal you find | What it can support | How to retain it |
|---|---|---|
| A visible date explicitly labeled published | A publisher's publication claim for the surrounding article | Save the label, value and article context |
datePublished on the matching article entity |
A structured publication claim | Save the script position, entity and raw value |
A visible update label or dateModified |
A publisher's modification claim | Store separately from publication |
HTTP Last-Modified |
The server's modification timestamp for the returned representation | Keep with response metadata |
| A search-result date | A date chosen by the search system | Treat as a discovery clue |
| Your request time or extraction timestamp | When that observation was made | Store as observation time |
| An unlabelled date in a footer or recommendation | A date with unresolved ownership or meaning | Leave unclassified until inspected |
The distinction matters even when every field is technically correct. RFC 9110's Last-Modified definition concerns the selected representation and what the origin server believes changed. It does not define the first editorial publication of an article. Keep it for retrieval and cache decisions rather than using it to fill an empty publication field.
Search dates require their own attribution. Google describes a search byline date as an estimate based on several signals. Its publisher guidance calls for clear visible labels and consistent structured dates. An agent should therefore open the result and inspect the underlying claim before treating a search date as original publication.
Inventory the signals before selecting a date
Start with a public page you are permitted to read. This example uses an AnyCrawler guide whose article header distinguishes publication from update. Save the HTML used for the inventory so a later reviewer can inspect the same evidence.
curl --fail --location \
'https://anycrawler.com/blog/extract-json-ld-from-web-pages/' \
--output sample.html
python date_inventory.py sample.html
Save the following as date_inventory.py. It collects familiar article meta fields, machine-readable time values, and literal date properties inside JSON-LD. It deliberately returns candidates rather than a winning date.
import json
import sys
from html.parser import HTMLParser
from pathlib import Path
class DateSignals(HTMLParser):
def __init__(self):
super().__init__()
self.signals = []
self.script = None
self.script_count = 0
def handle_starttag(self, tag, attrs):
a = dict(attrs)
if tag == "meta":
field = a.get("property", a.get("name", ""))
if field in {"article:published_time", "article:modified_time"}:
self.signals.append({"source": "meta", "field": field,
"raw": a.get("content")})
if tag == "time" and "datetime" in a:
self.signals.append({"source": "time", "field": "datetime",
"raw": a["datetime"], "meaning": "unclassified"})
if tag == "script" and a.get("type", "").lower() == "application/ld+json":
self.script_count += 1
self.script = []
def handle_data(self, data):
if self.script is not None:
self.script.append(data)
def handle_endtag(self, tag):
if tag == "script" and self.script is not None:
raw = "".join(self.script)
self.script = None
try:
self.walk(json.loads(raw), f"script[{self.script_count}]")
except json.JSONDecodeError as error:
self.signals.append({"source": "jsonld", "error": str(error)})
def walk(self, node, path):
if isinstance(node, dict):
for field in ("datePublished", "dateModified"):
if field in node:
self.signals.append({"source": path, "field": field,
"raw": node[field], "type": node.get("@type"),
"id": node.get("@id"), "url": node.get("url"),
"headline": node.get("headline")})
for key, value in node.items():
self.walk(value, f"{path}/{key}")
elif isinstance(node, list):
for index, value in enumerate(node):
self.walk(value, f"{path}/{index}")
parser = DateSignals()
parser.feed(Path(sys.argv[1]).read_text(encoding="utf-8"))
print(json.dumps({"jsonld_scripts": parser.script_count,
"signals": parser.signals}, ensure_ascii=False, indent=2))
The headline, type and path help identify whose date was found. Check those fields against the page's main heading and article identity. A date on a related article, embedded review or organization record must not become the date of the current article.
This is an inventory for common literal property names, not a complete JSON-LD processor. It does not resolve remote contexts, aliases, referenced nodes or the meaning of arbitrary vocabularies. A time element remains unclassified because the parser has not established its visible label or ownership. Malformed JSON is recorded as an error rather than repaired by guessing. Use the full JSON-LD extraction and verification workflow when you need a broader script inventory or entity review.
Check the date against readable context
In the executed sample, the HTML inventory found two JSON-LD scripts. The matching BlogPosting carried datePublished of 2026-10-09T02:44:34.781Z and dateModified of 2026-10-17T13:45:52.486Z. The article meta fields repeated those values. The header displayed October 9, 2026 as published and October 17, 2026 as updated.
The whole page also contained eight time elements. Some belonged to recommended articles below the main content. Choosing the newest date anywhere in that document would answer a different question from “When was this article published?” The correct review scope was the article's own header and matching structured entity.
Use readable extraction to check the surrounding labels. The free one-page URL to Markdown tool lets you inspect a page's text and the complete response. This is the corresponding request used for the sample:
curl --fail --get \
'https://api.anycrawler.com/free/v1/crawl' \
--data-urlencode 'url=https://anycrawler.com/blog/extract-json-ld-from-web-pages/' \
--output readable.json
That request returned HTTP 200, a target status_code of 200, and readable Markdown containing the expected title and both header dates. The response did not supply a dedicated publication-date field. It also omitted target final_url and credit usage, so the test record leaves those fields null. Those observations describe this request; they do not establish a contract for every URL or authenticated endpoint.
Keep the direct HTML and Markdown responses as separate inputs. The free tool returns readable content and may serve a cached result; it does not promise the original script inventory. Its response timestamp must not be relabeled as publication time, and the time you made the request does not establish when the underlying content first appeared.
Search can help find a candidate page. Fetch reads a known page's available HTML, Render can help when the required content depends on JavaScript, and Screenshot can preserve a visible date label for review. None of those steps independently proves a date's editorial accuracy. Login, clicking and other interactions belong to a browser workflow with the required access.
Give uncertainty an explicit state
After collecting candidates, make the acceptance decision outside the extraction function. A useful application record can distinguish the following states; these are suggested workflow labels, not a web standard or AnyCrawler response schema.
| State | Acceptance condition | What the agent may report |
|---|---|---|
publisher_claim |
A publication claim belongs to the target article, but corroboration is missing | The publisher states this publication date |
corroborated_publisher_claim |
The article's visible publication label and matching structured publication value agree at their shared precision | The publisher's visible and structured publication dates agree |
conflict |
Attributable publication claims remain inconsistent after meaning and timezone checks | The page supplies conflicting publication dates |
unknown |
No attributable publication claim was established | The original publication date is unknown |
Agreement within a page is useful consistency evidence. It is not independent corroboration of history: the visible label, meta tag and JSON-LD might all be populated from one CMS field. Repeating that field does not give it three independent votes.
Retain the raw date string alongside any parsed value. A date-only value supports a calendar date, not an invented midnight instant. A timestamp with an explicit offset can be compared as an instant; a timestamp without a timezone requires a documented policy or an unresolved state. Before declaring a conflict, check whether the dates describe different events, different entities, different precision, or the same instant in different offsets.
For an attributable claim, keep at least the requested and observed final URL when available, page title, observation time, raw value, signal location, entity identifier or headline, visible label/context, and acceptance state. Record what was actually observed rather than creating missing URL or usage fields. Keep a snapshot or hash reference if your workflow needs to revisit the decision.
When the values disagree, preserve both. A narrower follow-up might inspect the article header in a rendered page, check a clearly identified publisher record, or ask a reviewer to resolve the mismatch. Failure to retrieve a signal is also evidence about the extraction attempt; it does not justify borrowing a date from a footer or assigning today's date.
How strict should a recency filter be?
A page with unknown publication time can still contain useful evidence. Excluding it may be appropriate for a feed that promises newly published articles, while a technical research task may keep it for manual review and evaluate the content separately. Those workflows need different acceptance policies.
Choose the policy before applying a date cutoff. A strict “published after” rule should require an attributable publication claim with enough precision for the comparison. An exploratory workflow can retain unknowns in a separate review queue without calling them recent. The remaining question is what your product promises about time: newly published sources, recently modified sources, or information observed during the current research session? Store the event you can support and make that promise explicit.
Frequently asked questions
How can I find a publication date when no date is visible?
Inspect the HTML for a publication property on the article's structured entity or a clearly identified article meta field. Preserve the value and its location, then check that the entity matches the current page. You can report it as a publisher-supplied claim if the attribution is clear. If you find only update dates, unrelated timestamps or no usable signal, leave original publication unknown rather than manufacture a complete record.
Is Last-Modified the same as the publication date?
Last-Modified describes a server-reported modification of the selected representation. It does not establish when an article was first published. Keep it in the HTTP observation record if it is present, and use a separately attributable publication claim for editorial recency. An absent publication field should remain absent even when the response has a valid modification timestamp. This preserves the meaning of each field when another developer reviews the evidence.
Does datePublished prove when an article first appeared?
It establishes what the publisher encoded as a first-publication claim, provided you selected the right entity. That is useful evidence, but successful parsing does not independently verify the publisher's history. Compare it with the visible publication label and retain any disagreement. When those values agree, describe the result as a consistent publisher claim rather than a verified historical fact. Multiple fields fed by the same CMS value are not independent sources.
What should an agent do when date values disagree?
Check meaning and ownership before comparing timestamps. An update date should differ from publication, and a recommended article has its own date. Then compare shared precision and explicit timezone information without assigning a missing timezone. If the target article still has inconsistent publication claims, retain both raw values and a conflict state. A rendered inspection or publisher clarification may resolve it; choosing the earliest or latest value would merely hide the disagreement.
Can AnyCrawler return the publication date automatically?
The tested free request returned readable Markdown with the page's visible date labels, but no dedicated date field. Use that output to inspect context, and preserve separate HTML evidence when you need embedded date properties. Do not assume the free response contains raw scripts, a normalized publication date or every provenance field. Check the actual response and the contract of the endpoint you use, including any cache behavior, before designing an application record.
Will rendering reveal a missing publication date?
Rendering can help if the publisher adds the relevant date label or structured content through JavaScript. It cannot create a publication claim the publisher never supplied, establish that a claim is accurate, or decide which event an unlabelled timestamp describes. Compare the rendered article context with the original observation and record the retrieval path. If no attributable publication evidence emerges, keep the unknown state instead of treating a successful render as date verification.






