Targeted Scholar-based literature harvesting for battery/electrochemistry research, with reproducible logs and PDF-first collection.
This tool supports recurring literature updates without turning the workflow into a black box:
- query Scholar with controlled keywords
- extract metadata and PDF candidates
- save reachable PDFs
- record run provenance for monthly/quarterly review
It is intentionally designed for small, auditable collection runs.
| Capability | Implementation |
|---|---|
| Query execution | crawler.py CLI |
| HTML robustness | Multi-branch fallback parsing (classic, direct_ri, data_rp, archive_old) |
| Reproducibility | run_info.json with source mode, links, statuses, and timestamp |
| Offline debugging | --htmlfile mode using saved fixtures |
| Archive workflow | Query-scoped output folders + historical trail in archive/ and papers/ |
.
├── crawler.py # CLI entrypoint
├── scholar_helpers.py # parser and extraction utilities
├── requirements.txt
├── fixtures/ # saved Scholar HTML and link fixtures
├── archive/ # monthly run trail + paper library snapshots
├── papers/ # quarterly and final review writeups
├── run_monthly.bat # minimal scheduled runner (Windows)
└── notes.txt # operational notes and history
python3 -m pip install -r requirements.txt
python3 crawler.py "zinc ion battery machine learning" --limit 2python3 crawler.py "zinc ion battery machine learning" --limit 2python3 crawler.py "zinc ion battery machine learning" \
--limit 2 \
--htmlfile fixtures/znion_query_page.htmlpython3 crawler.py "zinc ion battery machine learning" \
--limit 2 \
--out-root /tmp/battery-crawler-downloadsrun_monthly.batPer query, the crawler writes:
<out-root>/<slug-query>/search_page.html(live mode)<out-root>/<slug-query>/*.pdf<out-root>/<slug-query>/run_info.json
run_info.json includes:
querysource_type(liveorhtmlfile)source_value(URL or fixture path)saved_filesresults_seen(title,main_link,pdf_link,meta,snippet,save_status)run_time
flowchart LR
A[Query input] --> B{Source mode}
B -->|live| C[Fetch Scholar page]
B -->|htmlfile| D[Load fixture HTML]
C --> E[Collect result boxes]
D --> E
E --> F[Extract links + metadata]
F --> G{PDF reachable?}
G -->|yes| H[Save PDF]
G -->|no| I[Record status]
H --> J[Write run_info.json]
I --> J
- Scholar HTML structure changes frequently; parser fallbacks are maintenance-heavy by design.
- Archived pages and live pages can differ significantly.
- Success rate depends on direct PDF availability in result cards.
- Non-PDF links and blocked/unreachable pages are expected in real runs.
- Keep request rates conservative.
- Use fixture mode for debugging whenever possible.
- Treat this as a research assistant utility, not a bulk scraping system.