pmt-scraper
Download and organise PDFs from Physics & Maths Tutor pages.
Point it at any PMT page that lists PDF links and it scrapes every PDF, sorts them into folders, and downloads them politely (rate-limited, resumable, skips existing files).
Install
pip install requests beautifulsoup4
Usage
python pmt_scrape.py <url> [options]
Options
Output
| Flag | Default | Description |
|---|---|---|
--out <dir> |
downloads |
Root output folder |
--organise heading |
✓ | Group by section heading on the page |
--organise path |
Mirror PMT's own folder structure | |
--organise flat |
All files in one folder | |
--delay <secs> |
1.0 |
Pause between downloads (be polite) |
--dry-run |
Print what would be saved, download nothing |
Filtering
| Flag | Description |
|---|---|
--keywords k1 k2 … |
Filter by keywords — see syntax below |
--years y1 y2 … |
Keep only PDFs mentioning any of these years |
--year-range FROM TO |
Keep only PDFs whose year falls within FROM–TO (inclusive) |
--years and --year-range can be used together; both constraints must pass (AND).
Keyword syntax — prefix each token to control how it matches:
| Prefix | Meaning |
|---|---|
word or +word |
Must be present (positive) |
-word |
Must be absent (negative) |
Matching is case-insensitive and searches the section heading, link text, and filename.
Years embedded in PMT's URL paths (e.g. .../2019/...) are detected automatically.
Undated files are always kept.
Examples
# All papers, grouped by heading
python pmt_scrape.py https://www.physicsandmathstutor.com/maths-revision/a-level-papers/
# Mark schemes only
python pmt_scrape.py <url> --keywords "mark scheme"
# Mark schemes only (positive keyword)
python pmt_scrape.py <url> --keywords +markscheme
# Mark schemes, excluding question papers
python pmt_scrape.py <url> --keywords +markscheme -questions
# Papers from 2018 to 2022
python pmt_scrape.py <url> --year-range 2018 2022
# Mark schemes for specific years (combine --years and --year-range)
python pmt_scrape.py <url> --keywords +markscheme --years 2019 2021 2023 --year-range 2019 2023
# Paper 1 only, no mark schemes, preview before downloading
python pmt_scrape.py <url> --keywords +paper1 -markscheme --dry-run
# Mirror PMT's folder structure
python pmt_scrape.py <url> --organise path
Project structure
pmt scraper/
├── pmt_scrape.py # entry point
├── pmt_scraper/
│ ├── __init__.py
│ ├── cli.py # argument parsing and main loop
│ ├── scraper.py # page fetching and PDF link extraction
│ ├── downloader.py # file download and output path logic
│ ├── filters.py # keyword and year filtering
│ └── utils.py # filename sanitisation, URL helpers
└── downloads/ # default output folder
Notes
- Downloads use a
.partsuffix until complete — interrupted runs are safe to resume. - Files already present (non-zero size) are skipped automatically.
- Pages that load links via JavaScript will not work; PMT's static pages are fine.
Metadata
Release files for pmt-scraper 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pmt_scraper-0.1.0.tar.gz | 7.4 kB | With provenance | Details for pmt_scraper-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pmt_scraper-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pmt_scraper-0.1.0-py3-none-any.whl |
Total release size: 16.3 kB
Release files / pmt_scraper-0.1.0.tar.gz
| Download URL | pmt_scraper-0.1.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6ac24c67813c160eee3126f0bff7958c89ae65ffc7365ab4d7505ebeead6196
|
|
BLAKE2b-256 checksum How to use checksums |
f2fc7aac9c5c8847283abcfdd46cfdba44c9a0f7e2fd2b5261609fd069bc6d9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 4, 2026.
Transparency logRelease files / pmt_scraper-0.1.0-py3-none-any.whl
| Download URL | pmt_scraper-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
457133ced104c539a857d3756b041dc4fbc7a945930155b1da5c030b9e451fb3
|
|
BLAKE2b-256 checksum How to use checksums |
eee12c0fba6c37eabd1d529c718cf3a1b2ebe9de9cc4317d958915ec07f5d3e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 4, 2026.
Transparency logSecurity for pmt-scraper 0.1.0
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.
Attestation for pmt_scraper-0.1.0.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 Jun 4, 2026.
Transparency logA 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.