Skip to main content

📸 SnapIR

Python PyPi CI status License

Capture web search over time. SnapIR is an open-source toolkit for creating snapshots of live web search: one time snapshots or repeated (longitudinal) ones. It links information needs, topics, queries, SERPs, captured web pages and relevance judgments across collection dates, so you can study how rankings, AI overviews and page content change, and evaluate retrieval systems on judgments made at the time of the search.

The SnapIR pipeline: define information needs (fetch debates, generate topics, generate queries), capture the web (collect SERPs, scrape web pages), assess relevance by humans or LLMs, and export snapshots

Each step is one CLI command. Steps 4 and 5 are repeated for every snapshot. Steps can be run on their own (for example, bring your own topics and start at step 4), are resumable (existing records are skipped) and can be scheduled with the included Prefect workflows.

Install

pip install snapir
playwright install chromium          # browser for capturing pages

Optional extras: snapir[gemini] for Gemini models, snapir[prefect] for the scheduled workflows.

The LLM steps (topics generate, queries generate, judgments generate) also need topic-gen:

pip install "topic-gen @ git+https://github.com/irgroup/topic-gen.git"

Quickstart: two snapshots of one query

This needs only a SerpApi key, no LLM. Use your own topic and query. IDs can be any unique strings.

export SERPAPI_API_KEY=...

echo '{"topic_id": "t1", "title": "EU AI Act enforcement", "description": "How is the EU AI Act being enforced?"}' > topics.jsonl
echo '{"topic_id": "t1", "query_id": "q1", "query": "eu ai act enforcement news"}' > queries.jsonl

snapir serps fetch --queries queries.jsonl --output data/serps
snapir documents scrape --serps data/serps/$(date +%F)_queries --output data/docs
snapir documents extract-text --documents data/docs/$(date +%F)

Run the same three commands again tomorrow (or later). Then package every day into a collection:

snapir export snapshot --serps data/serps --documents data/docs \
  --topics topics.jsonl --queries queries.jsonl --output collection

collection/<YYYY-MM-DD>/ now contains, for each day, the topics, queries, raw SERPs, the organic ranking as a TREC run, and the extracted page text.

To generate topics and queries from news debates, judge relevance and export qrels, follow the tutorial.

Commands

snapir
├── topics
│   ├── fetch-debates       Collect source debates from euro|topics
│   ├── generate            Generate topics from debates (LLM)
│   └── select              Add a topic and its queries to a curated set
├── queries
│   └── generate            Generate queries for topics (LLM)
├── serps
│   └── fetch               Fetch search results for queries (SerpApi)
├── documents
│   ├── scrape              Capture pages referenced by SERPs (MHTML, screenshot)
│   ├── extract-text        Extract page text, including PDFs
│   ├── review              Inspect screenshots interactively
│   └── clear               Remove flagged captures so the next scrape retries them
├── judgments
│   ├── generate            LLM relevance judgments (-DNA- prompt by default)
│   ├── create-questions    Generate the SoSci question pool
│   └── questionnaire       Build a SoSci questionnaire for human assessors
└── export
    ├── rankings            Rankings as a table
    ├── answers             Human assessments from SoSci
    ├── qrels               Aggregate assessments into TREC qrels
    ├── snapshot            Assemble a distributable collection, one directory per day
    └── verify              Check queries → SERPs → captures → text for gaps

snapir <group> <command> --help documents every option.

Configuration

All settings are environment variables:

Variable Used by
SNAPIR_LLM_MODEL, SNAPIR_LLM_BASE_URL, SNAPIR_LLM_API_KEY LLM steps, using any OpenAI-compatible endpoint. Models named gemini* use Google GenAI (pip install "snapir[gemini]")
SNAPIR_LLM_TEMPERATURE (default 1), SNAPIR_LLM_CONCURRENCY (default 1) LLM steps
SERPAPI_API_KEY serps fetch
BROWSER_PROFILE_DIR (default data/.browser_profile), EXTENSION_DIR (default data/extensions/idcac) documents scrape
SNAPIR_ROBOTS_USER_AGENT (default SnapIR); bypass with --ignore-robots documents scrape
SOSCI_EXPORT_URL default for export answers --sosci

Documentation

Responsible use

SnapIR obeys robots.txt by default and does not hide its automation unless you pass --stealth. You are responsible for following the terms of service of the search and scraping providers and for any copyright and data-protection law that applies to the pages you capture. Laws on redistributing captured pages differ by country.

License

MIT

Metadata

Release files for snapir 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapir 0.1.2
File Size Uploaded Provenance Actions
snapir-0.1.2.tar.gz 417.7 kB With provenance Details for snapir-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snapir 0.1.2
File Interpreter ABI Platform Actions
snapir-0.1.2-py3-none-any.whl Python 3 none any Details for snapir-0.1.2-py3-none-any.whl

Total release size: 499.9 kB

Release files / snapir-0.1.2.tar.gz

Download URL snapir-0.1.2.tar.gz
Size 417.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1681f89cbc113ee95700abcce96fd79da129757b9200b2e561440d34e659c49f
BLAKE2b-256 checksum
How to use checksums
68615faeeaa8404e887d487fa9b2c155938933ef27905c5242e6a04ce37f20dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / snapir-0.1.2-py3-none-any.whl

Download URL snapir-0.1.2-py3-none-any.whl
Size 82.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb737e86c1f1ae6c58dfa80102d0da4e4340159e98662aa041ec23df63c1f2eb
BLAKE2b-256 checksum
How to use checksums
370efe0b9c7edf5c0336d9de5beaf84390d0cfcc8503cd073b8029aa86957543
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for snapir 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for snapir-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page