用途:通过统一脚本调用 bioRxiv 和 medRxiv 的 API,获取预印本详情、出版关联信息以及按 DOI 查询,适合需要简洁预印本元数据摘要的场景。
主要能力:所有请求均使用 scripts/rest_request.py,base_url 固定为 https://api.biorxiv.org。支持 details 与 pubs 两类路径,例如 details/<server>/<start>/<end>/<cursor>/json、details/<server>/<doi>/na/json、pubs/<server>/<start>/<end>/<cursor>、pubs/<server>/<doi>/na/json。脚本接受 max_items,details 和 pubs 页面建议从 max_items=10 开始。默认返回简洁的 markdown 摘要,仅在用户明确要求机器可读输出时才返回原始 JSON。
使用方式:从 stdin 读取一个 JSON 对象,必填字段为 base_url、path,可选字段包括 method、params、headers、json_body、form_body、record_path、response_format、max_items、max_depth、timeout_sec、save_raw、raw_output_path。示例命令:echo '{"base_url":"https://api.biorxiv.org","path":"details/biorxiv/2025-03-21/2025-03-28/0/json","record_path":"collection","max_items":10}' | python scripts/rest_request.py。成功时返回 ok、source、path、method、status_code、warnings 以及紧凑记录或摘要;失败时返回 ok=false 及 error.code、error.message。
限制与注意事项:建议一次只取一个游标页,不要增大页大小或把长集合粘贴到对话中;长对话中应重新运行请求,不要依赖旧的工具输出;工具预览中的 ... 是界面截断,不属于真实请求。若需要完整页面内容,设置 save_raw=true 并报告保存的文件路径,而不是把大集合粘贴到聊天中。运行时引用仅限本文件和 scripts/rest_request.py。