Purpose
Retrieve current public SFDA pharmaceutical regulation listings or regulation-page content, preserving exact same-site regulation URLs and structured page text.
When to Use
Use when verifying the current SFDA pharmaceutical regulations index, inventorying its regulation links, or retrieving a specific regulation when its exact opaque ID or slug is known. The pharmaceutical index observed in the current site is https://www.sfda.gov.sa/en/regulations?tags=2.
Workflow
- For the current pharmaceutical regulations index, navigate directly to
https://www.sfda.gov.sa/en/regulations?tags=2withwaitUntil: "domcontentloaded"; do not begin at the homepage or rely on a stale previously registered page URL. - On the loaded index, run this evaluator to return the current index metadata and every exact regulation-page link exposed in the main content:
(() => {
const root = document.querySelector('main,[role="main"],article') || document.body;
const clean = value => (value || '').replace(/\s+/g, ' ').trim();
const links = [...root.querySelectorAll('a[href]')]
.map(a => ({text: clean(a.innerText), href: a.href}))
.filter(x => x.text || x.href);
const regulationLinks = links.filter(x => {
try {
const u = new URL(x.href, location.href);
return u.origin === location.origin && /^\/en\/regulations\/[^/?#]+$/.test(u.pathname);
} catch (_) { return false; }
});
return {
url: location.href,
title: clean(document.title),
heading: clean(root.querySelector('h1')?.innerText) || clean(document.querySelector('h1')?.innerText),
regulationLinks,
text: clean(root.innerText)
};
})()- If a particular regulation must be read, use the exact
hrefcaptured from the index rather than inventing an identifier, then navigate directly to that URL in one call and run the page extractor below. Regulation URLs may contain an opaque numeric ID or an opaque slug; the observed slug form is/en/regulations/clearance-conditions-and-requirements. - If only a regulation name is available, first locate it through the public regulations index/search results and read its exact
/en/regulations/{id-or-slug}href; never derive or guess the path from the title. - For a direct regulation page, run this evaluator after navigation:
(() => {
const root = document.querySelector('main,[role="main"],article') || document.body;
const clean = value => (value || '').replace(/\s+/g, ' ').trim();
const heading = clean(root.querySelector('h1')?.innerText) || clean(document.querySelector('h1')?.innerText);
const links = [...root.querySelectorAll('a[href]')]
.map(a => ({text: clean(a.innerText), href: a.href}))
.filter(x => x.text || x.href);
return {
url: location.href,
title: clean(document.title),
heading,
text: clean(root.innerText),
links
};
})()Site-Specific Gotchas
- The pharmaceutical regulations index uses the non-obvious
tags=2query parameter; preserve it when verifying the current filtered index. - SFDA regulation pages use opaque path components under
/en/regulations/; these can be numeric IDs or slugs. Do not fabricate either form. - The index may expose regulation links directly, making a stale saved detail URL unsuitable for current-inventory verification.
- Restrict inventory extraction to same-origin paths matching
/en/regulations/{single-component}so the listing URL and unrelated navigation links are excluded. - Prefer
main,[role="main"], orarticleto exclude navigation and footer content; both evaluators fall back tobodyif those regions are absent. - Preserve the returned
url, because redirects or locale changes may indicate that the public canonical page differs from the requested URL.
Expected Output
For index verification, return url, title, heading, normalized text, and regulationLinks, where each inventory item has the visible link text and exact absolute href. For a detail page, return url, title, heading, normalized readable text, and visible linked references.