Purpose
Find the latest earthquake published in the site's earthquake listing and extract its visible details and event link.
When to Use
Use for requests asking for the latest, most recent, or newest earthquake on elestadodelperu.com.
Workflow
- Navigate directly to
https://elestadodelperu.com/sismos/; do not visit the homepage or use the navigation menu. - On the loaded page, run this single-page extractor. The listing's event links use the stable
/sismos/evento/{event-key}URL pattern, and the first event link is the newest entry in the page's displayed order.
(() => {
const links = [...document.querySelectorAll('a[href^="/sismos/evento/"]')];
const seen = new Set();
const events = links
.map((a, i) => {
const url = new URL(a.getAttribute("href"), location.origin).href;
if (seen.has(url)) return null;
seen.add(url);
const container =
a.closest('article, li, [class*="card"], [class*="sismo"], tr') ||
a.parentElement;
return {
rank: i + 1,
url,
linkText: a.textContent.replace(/\\s+/g, " ").trim(),
listingText: (container?.textContent || a.textContent)
.replace(/\\s+/g, " ")
.trim(),
};
})
.filter(Boolean);
return { latest: events[0] || null, events };
})();- Report
latest.listingText(or its meaningful date, magnitude, location, and time fields) together withlatest.url. If no event link is returned, report that the page contains no listed earthquakes.
Site-Specific Gotchas
- The canonical listing URL is
/sismos/; the homepage navigation contains repeated links and is unnecessary. - Event detail links use
/sismos/evento/{event-key}. Do not fabricate an event key; resolve it from the listing. - A privacy-preferences/consent dialog may appear on initial visits. If it blocks the page, accept the site's consent once, then reload or continue to
/sismos/; this is not part of the normal navigation path. - The listing contains repeated or nested links in some layouts, so the extractor deduplicates event URLs and reads the surrounding card/row rather than only the anchor label.
Expected Output
Return the newest listed earthquake's displayed details, especially date/time, magnitude, location, and the corresponding event URL.