pub async fn work_text(
openalex: &OpenAlexClient,
zotero: Option<&ZoteroClient>,
datalab: Option<(&DatalabClient, ProcessingMode)>,
work_id: &str,
) -> Result<WorkTextResult, WorkTextError>Expand description
Download and extract the full text of a scholarly work.
Tries multiple sources in priority order:
- Local Zotero storage (filesystem)
- Remote Zotero API (if credentials available)
- Direct PDF URLs from OpenAlex locations (whitelisted domains)
- OpenAlex Content API (requires
OPENALEX_API_KEY)
When datalab is Some, the final extraction step uses the DataLab Marker
API instead of local pdfium extraction, producing higher-quality markdown.
The ProcessingMode controls quality vs. speed: Fast < Balanced < Accurate.