Faq Jsonld Extractor avatar

Faq Jsonld Extractor

Pricing

$3.00 / 1,000 results

Go to Apify Store
Faq Jsonld Extractor

Faq Jsonld Extractor

Pricing

$3.00 / 1,000 results

Rating

0.0

(0)

Developer

Eichan Jolly

Eichan Jolly

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

14 days ago

Last modified

Categories

Features

Limited permissions

Share

FAQ JSON-LD Extractor

One job: fetch one publicly accessible HTML page, look for FAQPage JSON-LD structured data, and save each actually declared question and accepted answer as one dataset row. No AI is involved.

Who it is for

Developers, content auditors, documentation maintainers and RAG data-preparation pipelines that need already-published structured FAQ content in two plain-text columns.

How it works (and what it does not do)

  1. Check the supplied URL is HTTP(S), resolves to public IP addresses and has no login credentials. Only the standard HTTP/HTTPS ports are allowed.
  2. Check that page access is allowed by the host's robots.txt. Make a single page request, with a descriptive User-Agent and short timeouts. Only same-host, same-scheme redirects are permitted. The HTML download is capped at 1 MB; no JavaScript runs.
  3. Parse HTML <script type="application/ld+json"> blocks, including top-level arrays and @graph. Find objects with @type: FAQPage, then mainEntity Question nodes containing a nonempty name and acceptedAnswer.text.
  4. Remove HTML tags from questions and answers, decode HTML entities and collapse whitespace. Keep source ordering; skip incomplete pairs and exact duplicates. Save up to maxPairs (default 50, maximum 100).

No matching pair: an ordinary dataset row with status: "error", a plain-language error, and null question/answer is written. This is not a fabricated FAQ. Invalid input or blocked/failed fetch instead produces a plain-language terminal error and nonzero exit code.

Example input (one real public URL)

The input-schema prefill uses httpbin.org's public base64 endpoint. It serves a small HTML fixture containing one genuine FAQPage JSON-LD script. This synthetic demonstration is a real HTTP endpoint, not a nonexistent placeholder and not a claim about a third-party site's FAQ quality. The URL is long because it encodes the sample HTML.

You can paste this exact prefilled input, or use tests/sample_input.json:

{
"url": "https://httpbin.org/base64/PGh0bWw+PHNjcmlwdCB0eXBlPSJhcHBsaWNhdGlvbi9sZCtqc29uIj57IkB0eXBlIjoiRkFRUGFnZSIsIm1haW5FbnRpdHkiOlt7IkB0eXBlIjoiUXVlc3Rpb24iLCJuYW1lIjoiV2hhdCBpcyBKU09OLUxEPyIsImFjY2VwdGVkQW5zd2VyIjp7IkB0eXBlIjoiQW5zd2VyIiwidGV4dCI6IkpTT04gc3RydWN0dXJlZCBkYXRhLiJ9fV19PC9zY3JpcHQ+PC9odG1sPg==",
"maxPairs": 50
}

Example output (one dataset row)

{
"status": "ok",
"source_url": "https://httpbin.org/base64/PGh0bWw+PHNjcmlwdCB0eXBlPSJhcHBsaWNhdGlvbi9sZCtqc29uIj57IkB0eXBlIjoiRkFRUGFnZSIsIm1haW5FbnRpdHkiOlt7IkB0eXBlIjoiUXVlc3Rpb24iLCJuYW1lIjoiV2hhdCBpcyBKU09OLUxEPyIsImFjY2VwdGVkQW5zd2VyIjp7IkB0eXBlIjoiQW5zd2VyIiwidGV4dCI6IkpTT04gc3RydWN0dXJlZCBkYXRhLiJ9fV19PC9zY3JpcHQ+PC9odG1sPg==",
"position": 1,
"question": "What is JSON-LD?",
"answer": "JSON structured data.",
"error": null
}

source_url always contains the full original URL (except any fragment, which is not sent to the website).

No data output example:

{
"status": "error",
"source_url": "https://example.org/page-without-faq-data",
"position": null,
"question": null,
"answer": null,
"error": "No FAQPage JSON-LD with complete questions and accepted answers was found on this page."
}

Input fields

FieldRequiredMeaning
urlYesOne publicly reachable http:// or https:// page, max 2,048 characters.
maxPairsNoMaximum output Q&A items, 1–100; default 50.

Each success dataset item has fixed keys: status, source_url, position, question, answer, error.

Limits and cautions

  • Extracts only JSON-LD FAQPage; ignores visually apparent FAQs, microdata, RDFa, QAPage and schema created by client-side JavaScript.
  • No translation, question generation, answer correctness assessment, legal or medical judgment, or guaranteed completeness.
  • Malformed JSON-LD and incomplete pairs are skipped, not guessed. JSON-LD can be outdated or disagree with what a visitor sees.
  • Does not follow page links; does not log in or bypass access restrictions; blocks non-public/local IPs. The public DNS check is a safety filter but cannot guarantee protection against all DNS rebinding scenarios.
  • Some sites block automated clients or disallow access in robots.txt; others may change or remove structured data. The public demonstration endpoint is maintained by a third party.
  • HTML parsing is rule-based and may not handle every nonstandard script encoding. Supported content types: HTML, XHTML or raw HTML sent as text/plain.
  • One page download, max 1 MB, short timeouts; robots.txt is fetched separately to respect the site's policy.

Run locally and test

Python 3.12+; no pip dependencies and no Apify SDK.

# From this Actor's root folder, use the actual prefilled URL:
mkdir -p storage/key_value_stores/default
cp tests/sample_input.json storage/key_value_stores/default/INPUT.json
python src/main.py
python -m unittest discover -s tests -v

For the complete working URL, use tests/sample_input.json as storage/key_value_stores/default/INPUT.json, or copy the exact prefill from input_schema.json. To replay the offline script-mode smoke (it simulates the website HTTP response, so network access is not required):

python tests/run_smoke.py
# Under the hood it invokes: python src/main.py

The smoke runner passes the exact JSON of tests/sample_input.json via ACTOR_INPUT_JSON. It calls python src/main.py using the system Python in this test environment; tests/sitecustomize.py simulates HTTP only while FAQ_OFFLINE_SMOKE=1 is set, and is not part of the Docker image. The runner records the actual terminal output and dataset rows in tests/smoke_*.

On Apify, runtime input and output use its documented REST storage API with the platform-provided token; locally, items go to storage/datasets/default/000000001.json etc. Only internal Apify storage uses a token; users provide no API keys.

Store listing and suggested price

  • Intended category: AI (data preparation, not generative AI).
  • Suggested pricing: $0.001 per successful extracted Q&A item; zero billable success items for a status: error row. This is only a commercial suggestion, not configured; publishing and billing are not part of the deliverable.
  • Structured suggestion: store_metadata.json.

Test provenance

The script-mode FAQ smoke uses the true production entry point and real dataset writer but offline mocked HTTP because direct external DNS is unavailable in the packaging environment. An independent public fetch confirmed the httpbin example URL responds with the encoded sample content; no actual Apify deployment or Docker build was performed. Read tests/smoke_evidence.txt and run python tests/run_smoke.py to reproduce.