Skip to main content

Modules

Skanyr

Site intelligence — a stored, searchable copy of a crawled site, its APIs and how it changes

2 min read


Skanyr keeps a stored copy of a site (a "digital twin") built from a crawl: its resources, the API endpoints found on it, the technologies it uses, and snapshots over time that you can search, diff and re-sync.

The hidden-API detectors run during a crawl. Read their results for a page with webgrph.detected_apis(page_url) (below), and their data with Kolektr's api-data calls.

From a crawl to a site

crawl = client.webgrph.crawl("https://example.com", max_pages=200)
site = client.skanyr.site_from_crawl(crawl.crawl_id)

apis = client.skanyr.get_site_apis(site["site_id"])
for api in apis:
    print(api)
const crawl = await client.webgrph.crawl('https://example.com', { maxPages: 200 });
const site = await client.skanyr.siteFromCrawl(crawl.crawlId);
const apis = await client.skanyr.getSiteApis(String(site['site_id']));

Site and API records are returned as the API sends them (JSON objects).

Search, snapshots and sync

hits = client.skanyr.search_site(site["site_id"], q="pricing")
snapshots = client.skanyr.list_snapshots(site["site_id"])
changes = client.skanyr.sync(site["site_id"])          # incremental re-fetch
print(changes["fetched"], changes["new_resources"], changes["modified_resources"], changes["has_changes"])
diff = client.skanyr.diff(site["site_id"])              # between the last two snapshots

sync re-fetches the site's resources and counts what changed (fetched, not_modified, new_resources, modified_resources, deleted, failed, total_bytes, snapshot_id). It runs the engine, so it is billed.

Detected APIs (from a crawl)

apis = client.webgrph.detected_apis("https://example.com")
print(apis["discovery_summary"])
for d in apis["detected_apis"]:
    print(d["detector"], d["status"], d["record_count"], d["endpoint"])
const apis = await client.webgrph.detectedApis('https://example.com');

The page must have been crawled first; otherwise the API answers 404 ("No discovery results found … Please run discovery first").

Response fields

| Field | Type | Description | |-------|------|-------------| | page_url | string | The page the detectors ran on | | discovery_summary | object | total_detectors, found_data, no_data, failed | | detected_apis | list | One entry per detector |

Each entry: detector, api_type, confidence, status (success, no_data or failed), record_count, total_available, has_data, endpoint, extraction_time_ms, error_message, message.

API data (paginated)

The records a detector found are read through Kolektr:

data = client.kolektr.get_api_data_paginated(
    "https://example.com/api/v1/products",
    offset=0,
    limit=1000,
)
const data = await client.kolektr.getApiDataPaginated('https://example.com/api/v1/products', 0, 1000);  // (endpoint, offset, limit)

The response has records and pagination (has_more says whether to read on); see the Pagination guide. Use client.kolektr.get_api_data(endpoint) for the full response. Results are cached per organisation; without a prior crawl the API answers 404.

Next steps

Was this page helpful?