papersearch 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +5 -5
- package/README.en.md +23 -17
- package/README.md +23 -17
- package/assets/overview.en.png +0 -0
- package/assets/overview.png +0 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts +2 -2
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js +2 -2
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batch.d.ts +10 -4
- package/dist/capabilities/pdf-discovery/batch.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batch.js +22 -7
- package/dist/capabilities/pdf-discovery/batch.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batchPapers.d.ts +3 -3
- package/dist/capabilities/pdf-discovery/batchPapers.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batchPapers.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts +5 -5
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batchSummary.js +4 -4
- package/dist/capabilities/pdf-discovery/batchSummary.js.map +1 -1
- package/dist/capabilities/pdf-discovery/handler.d.ts +4 -4
- package/dist/capabilities/pdf-discovery/handler.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/handler.js +10 -10
- package/dist/capabilities/pdf-discovery/handler.js.map +1 -1
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.d.ts +8 -0
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiAttempt.js → school/SchoolAttempt.js} +7 -7
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.js.map +1 -0
- package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.d.ts +86 -0
- package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiMcpClient.js → school/SchoolMcpClient.js} +144 -86
- package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.js.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiProgress.d.ts → school/SchoolProgress.d.ts} +5 -5
- package/dist/capabilities/pdf-discovery/school/SchoolProgress.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiProgress.js → school/SchoolProgress.js} +3 -3
- package/dist/capabilities/pdf-discovery/school/SchoolProgress.js.map +1 -0
- package/dist/capabilities/pdf-discovery/school/SchoolReadiness.d.ts +44 -0
- package/dist/capabilities/pdf-discovery/school/SchoolReadiness.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiReadiness.js → school/SchoolReadiness.js} +30 -27
- package/dist/capabilities/pdf-discovery/school/SchoolReadiness.js.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiResultNormalizer.d.ts → school/SchoolResultNormalizer.d.ts} +4 -4
- package/dist/capabilities/pdf-discovery/school/SchoolResultNormalizer.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi/CarsiResultNormalizer.js → school/SchoolResultNormalizer.js} +12 -12
- package/dist/capabilities/pdf-discovery/school/SchoolResultNormalizer.js.map +1 -0
- package/dist/capabilities/pdf-discovery/school/index.d.ts +9 -0
- package/dist/capabilities/pdf-discovery/school/index.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/school/index.js +12 -0
- package/dist/capabilities/pdf-discovery/school/index.js.map +1 -0
- package/dist/capabilities/pdf-discovery/{carsi → school}/types.d.ts +44 -35
- package/dist/capabilities/pdf-discovery/school/types.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/school/types.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.d.ts +3 -3
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js +3 -3
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js.map +1 -1
- package/dist/cli.js +98 -81
- package/dist/cli.js.map +1 -1
- package/dist/config/ConfigService.d.ts +15 -3
- package/dist/config/ConfigService.d.ts.map +1 -1
- package/dist/config/ConfigService.js +53 -10
- package/dist/config/ConfigService.js.map +1 -1
- package/dist/config/apiKeySignup.d.ts +1 -1
- package/dist/config/apiKeySignup.js +1 -1
- package/dist/core/handleToolCall.d.ts +2 -2
- package/dist/core/handleToolCall.d.ts.map +1 -1
- package/dist/core/handleToolCall.js +3 -3
- package/dist/core/handleToolCall.js.map +1 -1
- package/dist/infrastructure/pdf/PdfIdentity.d.ts +4 -2
- package/dist/infrastructure/pdf/PdfIdentity.d.ts.map +1 -1
- package/dist/infrastructure/pdf/PdfIdentity.js +66 -12
- package/dist/infrastructure/pdf/PdfIdentity.js.map +1 -1
- package/dist/management/capability-profile/index.d.ts +2 -2
- package/dist/management/capability-profile/index.d.ts.map +1 -1
- package/dist/management/capability-profile/index.js +27 -27
- package/dist/management/capability-profile/index.js.map +1 -1
- package/dist/management/capability-profile/schoolReadiness.d.ts +10 -0
- package/dist/management/capability-profile/schoolReadiness.d.ts.map +1 -0
- package/dist/management/capability-profile/schoolReadiness.js +13 -0
- package/dist/management/capability-profile/schoolReadiness.js.map +1 -0
- package/dist/management/failures/exportReport.js +2 -2
- package/dist/management/failures/exportReport.js.map +1 -1
- package/dist/management/reports/index.d.ts +1 -1
- package/dist/management/reports/index.d.ts.map +1 -1
- package/dist/management/reports/index.js +3 -3
- package/dist/management/reports/index.js.map +1 -1
- package/dist/management/{carsi → school}/autoUpdate.d.ts +5 -5
- package/dist/management/school/autoUpdate.d.ts.map +1 -0
- package/dist/management/{carsi → school}/autoUpdate.js +22 -10
- package/dist/management/school/autoUpdate.js.map +1 -0
- package/dist/management/{carsi → school}/cliProgress.d.ts +2 -2
- package/dist/management/school/cliProgress.d.ts.map +1 -0
- package/dist/management/{carsi → school}/cliProgress.js +5 -4
- package/dist/management/school/cliProgress.js.map +1 -0
- package/dist/management/school/host.d.ts.map +1 -0
- package/dist/management/school/host.js.map +1 -0
- package/dist/management/{carsi → school}/installer.d.ts +14 -12
- package/dist/management/school/installer.d.ts.map +1 -0
- package/dist/management/{carsi → school}/installer.js +125 -40
- package/dist/management/school/installer.js.map +1 -0
- package/dist/management/school/legacy.d.ts +33 -0
- package/dist/management/school/legacy.d.ts.map +1 -0
- package/dist/management/school/legacy.js +114 -0
- package/dist/management/school/legacy.js.map +1 -0
- package/dist/management/{carsi → school}/login.d.ts +4 -4
- package/dist/management/school/login.d.ts.map +1 -0
- package/dist/management/{carsi → school}/login.js +4 -4
- package/dist/management/school/login.js.map +1 -0
- package/dist/management/{carsi → school}/runtime.d.ts +1 -1
- package/dist/management/school/runtime.d.ts.map +1 -0
- package/dist/management/{carsi → school}/runtime.js +3 -3
- package/dist/management/school/runtime.js.map +1 -0
- package/dist/management/{carsi → school}/settingsWindow.d.ts +1 -1
- package/dist/management/school/settingsWindow.d.ts.map +1 -0
- package/dist/management/{carsi → school}/settingsWindow.js +3 -3
- package/dist/management/school/settingsWindow.js.map +1 -0
- package/dist/management/smoke/index.d.ts +2 -2
- package/dist/management/smoke/index.d.ts.map +1 -1
- package/dist/management/smoke/index.js +9 -9
- package/dist/management/smoke/index.js.map +1 -1
- package/dist/management/uninstall/index.d.ts.map +1 -1
- package/dist/management/uninstall/index.js +4 -1
- package/dist/management/uninstall/index.js.map +1 -1
- package/dist/platforms/ScienceDirectSearcher.js +1 -1
- package/dist/platforms/ScienceDirectSearcher.js.map +1 -1
- package/dist/platforms/ScopusSearcher.js +1 -1
- package/dist/platforms/ScopusSearcher.js.map +1 -1
- package/package.json +5 -5
- package/{carsi → school}/README.md +17 -17
- package/school/paper_search_school/__init__.py +3 -0
- package/{carsi/paper_search_carsi → school/paper_search_school}/_core/__init__.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/_core/racing.pyx +2 -2
- package/{carsi/paper_search_carsi → school/paper_search_school}/assets/capsule.html +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/assets/capsule_en.json +26 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/__init__.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/backend.py +3 -3
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/batch_session.py +21 -0
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/challenge_interaction.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/ego_relay.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/preview.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/browser/watchdog.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/cache.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/cli.py +13 -13
- package/{carsi/paper_search_carsi → school/paper_search_school}/cold_start.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/config.py +30 -9
- package/{carsi/paper_search_carsi → school/paper_search_school}/data/institutional_identity_policy.json +3 -3
- package/{carsi/paper_search_carsi → school/paper_search_school}/data/publisher_access_catalog.json +21 -21
- package/{carsi/paper_search_carsi → school/paper_search_school}/data/publisher_browser_verification_matrix.json +21 -21
- package/school/paper_search_school/data_home.py +20 -0
- package/school/paper_search_school/engine/__init__.py +1 -0
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch.py +3 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_capture.py +5 -5
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_common.py +2 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_institution.py +114 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_login.py +27 -2
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/bridge.py +4 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/engine/pdf_guard.py +66 -8
- package/{carsi/paper_search_carsi → school/paper_search_school}/entitlements.py +3 -2
- package/{carsi/paper_search_carsi → school/paper_search_school}/federations/__init__.py +1 -1
- package/school/paper_search_school/federations/builtin/incommon.json +11 -0
- package/school/paper_search_school/federations/builtin/infed.json +11 -0
- package/school/paper_search_school/federations/builtin/liaf.json +11 -0
- package/school/paper_search_school/federations/builtin/omren.json +11 -0
- package/school/paper_search_school/federations/builtin/pkifed.json +11 -0
- package/school/paper_search_school/federations/builtin/tigerfed.json +11 -0
- package/school/paper_search_school/federations/builtin/yetkim.json +11 -0
- package/{carsi/paper_search_carsi → school/paper_search_school}/federations/schools.py +59 -18
- package/{carsi/paper_search_carsi → school/paper_search_school}/issues.py +3 -2
- package/{carsi/paper_search_carsi → school/paper_search_school}/log.py +7 -6
- package/{carsi/paper_search_carsi → school/paper_search_school}/login_routes.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/mcp_progress.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/network.py +2 -2
- package/{carsi/paper_search_carsi → school/paper_search_school}/orchestrator.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/progress_capsule.py +4 -4
- package/{carsi/paper_search_carsi → school/paper_search_school}/progress_reporter.py +30 -12
- package/{carsi/paper_search_carsi → school/paper_search_school}/progress_status.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/progress_view.py +34 -3
- package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/model.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/schema.json +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/report_sanitizer.py +1 -1
- package/{carsi/paper_search_carsi → school/paper_search_school}/server.py +32 -18
- package/{carsi/paper_search_carsi → school/paper_search_school}/session_broker.py +3 -2
- package/{carsi/paper_search_carsi → school/paper_search_school}/tor.py +1 -1
- package/{carsi → school}/pyproject.toml +4 -4
- package/skills/paper-search/SKILL.md +16 -15
- package/skills/paper-search/references/browser-download.md +11 -11
- package/skills/paper-search/references/capability-routing.md +2 -2
- package/skills/paper-search/references/cli-contract.md +16 -16
- package/skills/paper-search/references/federation-support.md +19 -3
- package/skills/paper-search/references/management-layer.md +8 -8
- package/skills/paper-search/references/publisher-support.md +2 -2
- package/skills/paper-search/references/{carsi-setup.md → school-setup.md} +19 -19
- package/skills/paper-search/references/setup.md +4 -4
- package/carsi/paper_search_carsi/__init__.py +0 -3
- package/carsi/paper_search_carsi/engine/__init__.py +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.d.ts +0 -8
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts +0 -62
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiProgress.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiProgress.js.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts +0 -42
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiResultNormalizer.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiResultNormalizer.js.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts +0 -8
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/index.js +0 -11
- package/dist/capabilities/pdf-discovery/carsi/index.js.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/carsi/types.js.map +0 -1
- package/dist/management/capability-profile/carsiReadiness.d.ts +0 -10
- package/dist/management/capability-profile/carsiReadiness.d.ts.map +0 -1
- package/dist/management/capability-profile/carsiReadiness.js +0 -13
- package/dist/management/capability-profile/carsiReadiness.js.map +0 -1
- package/dist/management/carsi/autoUpdate.d.ts.map +0 -1
- package/dist/management/carsi/autoUpdate.js.map +0 -1
- package/dist/management/carsi/cliProgress.d.ts.map +0 -1
- package/dist/management/carsi/cliProgress.js.map +0 -1
- package/dist/management/carsi/host.d.ts.map +0 -1
- package/dist/management/carsi/host.js.map +0 -1
- package/dist/management/carsi/installer.d.ts.map +0 -1
- package/dist/management/carsi/installer.js.map +0 -1
- package/dist/management/carsi/login.d.ts.map +0 -1
- package/dist/management/carsi/login.js.map +0 -1
- package/dist/management/carsi/runtime.d.ts.map +0 -1
- package/dist/management/carsi/runtime.js.map +0 -1
- package/dist/management/carsi/settingsWindow.d.ts.map +0 -1
- package/dist/management/carsi/settingsWindow.js.map +0 -1
- /package/assets/{carsi-flow.en.png → school-flow.en.png} +0 -0
- /package/assets/{carsi-flow.png → school-flow.png} +0 -0
- /package/dist/capabilities/pdf-discovery/{carsi → school}/types.js +0 -0
- /package/dist/management/{carsi → school}/host.d.ts +0 -0
- /package/dist/management/{carsi → school}/host.js +0 -0
- /package/{carsi → school}/LICENSE +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/acm/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/acs/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/aha_journals/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/ams/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/annual_reviews/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/aps/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/asce/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/base.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/bmj/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/copernicus/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/dovepress/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/elsevier/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/elsevier/journal_site.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/elsevier/sciencedirect.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/frontiers/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/ieee/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/iop/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/jama/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/karger/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/lww/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/lww/journals_lww.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/lww/ovid.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/mdpi/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/nejm/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/neurology/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/optica/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/oup/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/platforms/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/platforms/atypon/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/platforms/figshare/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/platforms/silverchair/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/plos/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/pnas/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/rsc/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/sage/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/science/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/springer/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/taylor_francis/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/thieme/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/wiley/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/adapters/world_scientific/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/api_keys.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/assets/api_keys.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/assets/icon-32.png +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/assets/icon-512.png +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/assets/icon-64.png +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/assets/icon.svg +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/assets/papersearch-notifier +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/blocked_journals.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/browser/challenges.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/browser/cookies.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/browser/driver.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/browser/engine.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/browser/foreground.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/browser/profiles.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/capsule_placement.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/capsule_window.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/carsi_schools.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/cli_config.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/download_diagnostics.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/download_directory.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/access_rules.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_access.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_diagnostics.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_pdf_urls.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_runs.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_user.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/batch_waits.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/login_wait.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/page_activity.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/page_supplements.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/router.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/supplement_transfer.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/engine/supplements.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/extractors/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/extractors/pdf_extractor.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/failure_export.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/carsi.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/gakunin.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/hkaf.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/kafe.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/openathens.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/sgaf.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/federations/builtin/sifulan.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/i18n.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/identifiers.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/page_snapshot.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/pdf_text.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/pdf_utils.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/progress_macos.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/__init__.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/acm.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/acs.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/aha-journals.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/aip.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/ams.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/annual-reviews.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/aps.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/asce.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/bmj.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/copernicus.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/dovepress.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/elsevier.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/frontiers.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/ieee.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/iop.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/jama.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/karger.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/lww.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/mdpi.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/nejm.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/neurology.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/optica.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/oxfordacademic.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/plos.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/pnas.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/royalsocietypublishing.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/rsc.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/sage.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/science.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/springer.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/taylor-francis.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/thieme.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/wiley.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/builtin/world-scientific.json +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/extensions.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/loader.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/profiles.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/publishers/site.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/rate_limit.py +0 -0
- /package/{carsi/paper_search_carsi → school/paper_search_school}/user_settings.py +0 -0
|
@@ -577,7 +577,10 @@ class LoginMixin:
|
|
|
577
577
|
# Shibboleth's attribute-release and terms-of-use forms, whatever the language.
|
|
578
578
|
_IDP_CONFIRMATION_JS = """() => document.querySelector('[name="_eventId_TermsRejected"]') ? 'terms-of-use'
|
|
579
579
|
: document.querySelector('[name="_shib_idp_consentOptions"], [name="_shib_idp_consentIds"]') ? 'attribute-release' : ''"""
|
|
580
|
-
|
|
580
|
+
# Shibboleth's "Message Security Error": the identity provider could not trust the
|
|
581
|
+
# publisher's request (a school's IdP to Elsevier, 2026-11-12).
|
|
582
|
+
_IDP_ERROR_RE = re.compile(r"未知错误|系统错误|服务异常|认证失败|出错了|\b5\d{4}\b.{0,20}错误|an unexpected error|error code|system error"
|
|
583
|
+
r"|message security error", re.I)
|
|
581
584
|
|
|
582
585
|
# A publisher's own terms form on the way to the school: SIAM's SAML consent
|
|
583
586
|
# ("I have read and agree to the Terms and Conditions and Privacy Policy.",
|
|
@@ -730,7 +733,7 @@ class LoginMixin:
|
|
|
730
733
|
r"|sorry, you have been blocked|no institutions found|not registered for use with this service"
|
|
731
734
|
r"|application you have accessed is not registered|may not be enabled for this type of authentication"
|
|
732
735
|
r"|can't find your institution|access to this resource has been restricted by your organization|oa-ap-4032"
|
|
733
|
-
r"|不支持的请求|does not have access to this resource"
|
|
736
|
+
r"|不支持的请求|does not have access to this resource|message security error|reported an idp error"
|
|
734
737
|
r"|temporarily unavailable|verify you are human|are you a robot|checking your browser|正在进行安全验证", re.I)
|
|
735
738
|
|
|
736
739
|
def _login_block_reason(self, page: Any) -> str:
|
|
@@ -743,6 +746,8 @@ class LoginMixin:
|
|
|
743
746
|
def _block_evidence_for(self, code: str, page: Any) -> str:
|
|
744
747
|
if code == "login_page_closed":
|
|
745
748
|
return "the browser window was closed"
|
|
749
|
+
if code == "idp_login_error" and self._on_browser_error_page(page):
|
|
750
|
+
return f"the school's login server could not be reached: {self._school_unreachable}"
|
|
746
751
|
if code == "institution_pdf_entitlement_missing":
|
|
747
752
|
line = self._denial_line(page)
|
|
748
753
|
if line:
|
|
@@ -758,9 +763,18 @@ class LoginMixin:
|
|
|
758
763
|
return f'{url.hostname or ""}: "{quoted[:200]}"'
|
|
759
764
|
return f"{url.hostname or ''}{url.path[:80]} | {self._title(page)[:80]} ({type(self.adapter).__name__} rule)"
|
|
760
765
|
|
|
766
|
+
def _on_browser_error_page(self, page: Any) -> bool:
|
|
767
|
+
"""The browser's own error page after a navigation to the school's login
|
|
768
|
+
server failed (``_follow_login_route``): nobody can sign in there."""
|
|
769
|
+
return bool(getattr(self, "_school_unreachable", "")) and str(getattr(page, "url", "") or "").startswith(
|
|
770
|
+
"chrome-error://")
|
|
771
|
+
|
|
761
772
|
def _login_block_check(self, page: Any) -> str:
|
|
762
773
|
if page.is_closed() is True:
|
|
763
774
|
return "login_page_closed" # the user closed the window
|
|
775
|
+
if self._on_browser_error_page(page):
|
|
776
|
+
# Two schools' login servers did not answer from abroad (2026-11-12).
|
|
777
|
+
return "idp_login_error"
|
|
764
778
|
try:
|
|
765
779
|
parsed_idp = urlparse(str(getattr(page, "url", "") or ""))
|
|
766
780
|
if self._is_idp_host(parsed_idp.netloc):
|
|
@@ -803,6 +817,10 @@ class LoginMixin:
|
|
|
803
817
|
return override
|
|
804
818
|
if "unsupported request" in haystack and "not registered for use with this service" in haystack:
|
|
805
819
|
return "institution_not_registered"
|
|
820
|
+
# A publisher's Shibboleth saying the school's identity provider answered with
|
|
821
|
+
# an error ("SAML response reported an IdP error ... AuthnFailed", 2026-11-12).
|
|
822
|
+
if "saml response reported an idp error" in haystack:
|
|
823
|
+
return "idp_login_error"
|
|
806
824
|
# The same Shibboleth page in Chinese: "Web登陆服务 - 不支持的请求" on the
|
|
807
825
|
# school's IdP, the school has not enabled this publisher (JAMA, 2026-11-07).
|
|
808
826
|
if "不支持的请求" in haystack and self._is_idp_host(urlparse(current_url).netloc):
|
|
@@ -833,9 +851,16 @@ class LoginMixin:
|
|
|
833
851
|
# school has not enabled (2026-11-02). A page there that is no login form, no
|
|
834
852
|
# SAML hand-over and no "please wait" page, unchanged this long, ends the item.
|
|
835
853
|
SCHOOL_SITE_STAY_SEC = 12
|
|
854
|
+
# A username-first page (Okta's "identifier" field, no password box yet: a
|
|
855
|
+
# school's login was taken for its portal and ended, 2026-11-12) is a login;
|
|
856
|
+
# a portal's search box is not.
|
|
836
857
|
_SCHOOL_PAGE_STATE_JS = r"""() => ({
|
|
837
858
|
ready: document.readyState === 'complete',
|
|
838
859
|
login: !!document.querySelector('input[type="password"], input[autocomplete="one-time-code"]')
|
|
860
|
+
|| [...document.querySelectorAll('input')].some(el => el.getClientRects().length > 0 && !el.disabled
|
|
861
|
+
&& !el.readOnly && ['text', 'email'].includes(el.type) && (el.type === 'email'
|
|
862
|
+
|| /username|email/i.test(el.autocomplete || '')
|
|
863
|
+
|| /user|login|identifier|account|email|netid|学号|工号|账号|帐号/i.test(`${el.name} ${el.id}`)))
|
|
839
864
|
|| /扫码|二维码|QR ?code|验证码|verification code/i.test((document.body && document.body.innerText || '').slice(0, 4000)),
|
|
840
865
|
handover: !!document.querySelector('input[name="SAMLResponse"], input[name="SAMLRequest"], input[name="RelayState"]')
|
|
841
866
|
|| /^\s*(?:loading|please wait|redirecting|正在跳转|跳转中|请稍候|处理中)/i.test(document.title || '')})"""
|
|
@@ -211,7 +211,7 @@ def _map_to_instsci_config(backend_config: dict[str, Any], output_path: Path):
|
|
|
211
211
|
elsevier_api_key=backend_config.get("elsevier_api_key", ""),
|
|
212
212
|
elsevier_inst_token=backend_config.get("elsevier_insttoken", ""),
|
|
213
213
|
carsi_enabled=backend_config.get("carsi_enabled", False),
|
|
214
|
-
|
|
214
|
+
school_name=backend_config.get("school_name", ""),
|
|
215
215
|
output_dir=str(output_path.parent),
|
|
216
216
|
cache_dir=backend_config.get("cache_dir", ""),
|
|
217
217
|
)
|
|
@@ -565,6 +565,9 @@ def _try_browser_batch_download(
|
|
|
565
565
|
# The browser call never returned and the driver was stopped:
|
|
566
566
|
# whatever the engine reported after that is a consequence.
|
|
567
567
|
result.reason = result.state = watchdog.failure_code()
|
|
568
|
+
if batch is not None:
|
|
569
|
+
# What a wait of the batch keeps the publisher's session alive with.
|
|
570
|
+
batch.article_url = (result.final_url or result.article_url) if result.ok else ""
|
|
568
571
|
if supplements_mode in ("with", "only"):
|
|
569
572
|
if result.state in ("browser_unresponsive", "browser_operation_timeout"):
|
|
570
573
|
result.supplements = [{"status": "skipped", "reason": result.state,
|
|
@@ -11,7 +11,8 @@ misread letters, reading order) does not matter, and the evidence is weighed:
|
|
|
11
11
|
|
|
12
12
|
- strong: the whole title, exactly (letters only, at least 50 of them),
|
|
13
13
|
standing as a title (an exact match inside a longer line counts one level lower);
|
|
14
|
-
- single: the target DOI; the title with a few misread letters; a shorter title
|
|
14
|
+
- single: the target DOI; the title with a few misread letters; a shorter title; a title
|
|
15
|
+
too short to count alone ("Reply") on its own line right next to the target DOI's line.
|
|
15
16
|
|
|
16
17
|
Strong evidence, or two single pieces, verify the PDF; one single piece verifies
|
|
17
18
|
it while the pages print no other DOI. Other DOIs and no evidence at all:
|
|
@@ -20,9 +21,14 @@ another article. A title's numbers must always be exact. An attachment
|
|
|
20
21
|
(correction, retraction, briefing, letter to the editor), each known by its own
|
|
21
22
|
heading line, are not the article, unless the notice is itself the requested
|
|
22
23
|
item: its title says so, or the pages name it (its DOI in the header, or its
|
|
23
|
-
whole title and its DOI) and print no other DOI. A
|
|
24
|
+
whole title and its DOI) and print no other DOI. A DOI the pages label as the article
|
|
25
|
+
a notice is about ("DOI of original article:", "Correction to:") is no other DOI for
|
|
26
|
+
the notice itself (a letter that names the article it discusses); when that label
|
|
27
|
+
points at the requested DOI, the PDF is a notice about it. A scan without a text layer is
|
|
24
28
|
``"source"`` when the URL it came from names the DOI (``assess`` with ``source``;
|
|
25
|
-
the frontend passes it, the engine does not)
|
|
29
|
+
the frontend passes it, the engine does not); so is a page that prints no DOI at all and is
|
|
30
|
+
no notice or attachment, for an item named like a section rather than an article (a
|
|
31
|
+
one-page "Journal Club" note, "Issue Information").
|
|
26
32
|
|
|
27
33
|
``classify`` gives ``"match"`` (verified), ``"other"`` (another article),
|
|
28
34
|
``"unknown"`` (no decision: no text layer, or nothing printed) or ``"invalid"``
|
|
@@ -66,6 +72,14 @@ _NOTICE = re.compile(
|
|
|
66
72
|
r"|:[ \t]*(?:correction|erratum|corrigendum|retraction|expression of concern)[ \t]*$", re.I | re.M)
|
|
67
73
|
# A requested item whose title says it is a notice ("…: Erratum", "Reply to …").
|
|
68
74
|
_NOTICE_TITLE = re.compile(r"\b(?:erratum|corrigendum|correction|retraction|retracted|withdrawn|expression of concern|reply to|letter)\b", re.I)
|
|
75
|
+
# A label for the article a notice is about, followed by its DOI ("DOI of original article:
|
|
76
|
+
# https://doi.org/…" under an Elsevier letter or reply, 2026-11-12; "Correction to: Nature
|
|
77
|
+
# https://doi.org/…"; "The original article can be found online at …").
|
|
78
|
+
_ABOUT_LABEL = re.compile(
|
|
79
|
+
r"\b(?:doi\s+of\s+(?:the\s+)?original\s+article|(?:the\s+)?original\s+article(?:\s+can\s+be\s+found\s+online\s+at|\s+is\s+available\s+(?:online\s+)?at)?"
|
|
80
|
+
r"|(?:correction|erratum|corrigendum|addendum)\s+to|retraction\s+(?:note\s+|notice\s+)?(?:to|of)|comment(?:ary)?\s+on"
|
|
81
|
+
r"|(?:in\s+)?(?:reply|response)\s+to|see\s+the\s+article|refers\s+to|linked\s+article)\s*:?", re.I)
|
|
82
|
+
_ABOUT_REACH = 200 # how far after its label the DOI of the article a notice is about may be
|
|
69
83
|
# A DOI may break right after its prefix ("https://doi.org/10.1016/" then "S0140-…", The Lancet).
|
|
70
84
|
_DOI_IN_TEXT = re.compile(r"10\.\d{4,9}/(?:[ \t]*\n[ \t]*)?[^\s\"<>]+")
|
|
71
85
|
_LETTER = re.compile(r"[a-zЀ-ӿ一-鿿]")
|
|
@@ -162,6 +176,19 @@ def _title_evidence(text: str, chars: str, at: list[int], title: str) -> str | N
|
|
|
162
176
|
return "single" if end > 0 and _numbers_match(window(end, len(key) + errors), plain) else None
|
|
163
177
|
|
|
164
178
|
|
|
179
|
+
def _short_title_beside_doi(text: str, target: str, title: str) -> bool:
|
|
180
|
+
"""A title too short to count alone ("Reply") on its own line within two lines of the
|
|
181
|
+
target DOI's line (Wiley letters: "DOI 10.1002/…" then "Reply", 2026-11-12)."""
|
|
182
|
+
key = _letters(normalize_doi_text(_plain_title(title)))[0]
|
|
183
|
+
if not key or _weight(key) >= SHORT_TITLE:
|
|
184
|
+
return False
|
|
185
|
+
lines = text.split("\n")
|
|
186
|
+
for i, line in enumerate(lines):
|
|
187
|
+
if _doi_named(line, target) and any(_letters(near)[0] == key for near in lines[max(0, i - 2):i] + lines[i + 1:i + 3]):
|
|
188
|
+
return True
|
|
189
|
+
return False
|
|
190
|
+
|
|
191
|
+
|
|
165
192
|
def _target_doi(identifier: str) -> str:
|
|
166
193
|
return re.sub(r"^(?:https?://(?:dx\.)?doi\.org/|doi:\s*)", "", (identifier or "").strip().lower())
|
|
167
194
|
|
|
@@ -184,12 +211,30 @@ def _doi_named(pages: str, target: str) -> bool:
|
|
|
184
211
|
return re.search(rf"(?<![0-9.]){head}{pattern(suffix)}(?![0-9a-z_/-]|\.[0-9a-z])", pages) is not None
|
|
185
212
|
|
|
186
213
|
|
|
214
|
+
def _clean_doi(match: re.Match[str]) -> str:
|
|
215
|
+
return re.sub(r"[.,;:)\]]+$", "", re.sub(r"\s+", "", match.group(0)))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _same_article(doi: str, target: str) -> bool:
|
|
219
|
+
"""``doi`` is the target, or a piece, an extension, a misprint or an older prefix of it."""
|
|
220
|
+
own, own_suffix = _bare(target), _bare(_suffix(target))
|
|
221
|
+
return (own.startswith(_bare(doi)) or _bare(doi).startswith(own)
|
|
222
|
+
or (len(own_suffix) >= SHARED_SUFFIX and _bare(_suffix(doi)) == own_suffix))
|
|
223
|
+
|
|
224
|
+
|
|
187
225
|
def _other_dois(pages: str, target: str) -> list[str]:
|
|
188
226
|
"""DOIs printed that are not the target, nor a piece, an extension, a misprint or an older prefix of it."""
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
227
|
+
return [doi for doi in map(_clean_doi, _DOI_IN_TEXT.finditer(pages)) if not _same_article(doi, target)]
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _about_dois(pages: str) -> list[str]:
|
|
231
|
+
"""DOIs the pages label as the article a notice is about: the first DOI after each label."""
|
|
232
|
+
found = []
|
|
233
|
+
for label in _ABOUT_LABEL.finditer(pages):
|
|
234
|
+
doi = _DOI_IN_TEXT.search(pages, label.end(), label.end() + _ABOUT_REACH)
|
|
235
|
+
if doi:
|
|
236
|
+
found.append(_clean_doi(doi))
|
|
237
|
+
return found
|
|
193
238
|
|
|
194
239
|
|
|
195
240
|
def _title_before(text: str, title: str) -> bool:
|
|
@@ -225,7 +270,13 @@ def evidence(first_pages: str, identifier: str, title: str = "") -> dict | None:
|
|
|
225
270
|
chars, at = _letters(front)
|
|
226
271
|
doi = _doi_named(front, target)
|
|
227
272
|
found = _title_evidence(front, chars, at, title) if (title or "").strip() else None
|
|
273
|
+
if found is None and doi and _short_title_beside_doi(front, target, title or ""):
|
|
274
|
+
found = "single"
|
|
228
275
|
others = _other_dois(front, target)
|
|
276
|
+
about = _about_dois(front)
|
|
277
|
+
if not any(_same_article(doi, target) for doi in about):
|
|
278
|
+
# The article a notice discusses is not another article on these pages.
|
|
279
|
+
others = [doi for doi in others if doi not in about]
|
|
229
280
|
# A notice is itself the requested item when the pages name it (its DOI in the
|
|
230
281
|
# header, Neurology; its whole title and its DOI, a letter under a "Letter to the
|
|
231
282
|
# editor" heading) and print no other DOI. A notice about an article prints its
|
|
@@ -271,7 +322,14 @@ def assess(first_pages: str, identifier: str, title: str = "", source: str = "")
|
|
|
271
322
|
return "mismatch"
|
|
272
323
|
scan = (sum(char.isalpha() for char in first_pages or "") < SCAN_MAX_LETTERS
|
|
273
324
|
and not (found and (found["not_article"] or found["other_dois"])))
|
|
274
|
-
|
|
325
|
+
# Pages that print no DOI at all and are no notice or attachment, for an item named
|
|
326
|
+
# like a section rather than an article (under CLOSE_TITLE letters: Wiley's "Journal
|
|
327
|
+
# Club" and "Issue Information", 2026-11-12): the URL is the evidence, as for a scan.
|
|
328
|
+
# An article's title not printed is a reason for doubt (an issue's front matter at
|
|
329
|
+
# the article's address).
|
|
330
|
+
short = _weight(_letters(normalize_doi_text(_plain_title(title)))[0]) < CLOSE_TITLE
|
|
331
|
+
no_doi = bool(found) and short and not (found["not_article"] or found["doi"] or found["other_dois"] or found["title"])
|
|
332
|
+
return "source" if source and (scan or no_doi) and _source_names_doi(source, _target_doi(identifier)) else "unverified"
|
|
275
333
|
|
|
276
334
|
|
|
277
335
|
def first_pages_text(body: bytes) -> str | None:
|
|
@@ -23,6 +23,7 @@ from pathlib import Path
|
|
|
23
23
|
from typing import Any
|
|
24
24
|
|
|
25
25
|
from .log import get_logger
|
|
26
|
+
from .data_home import default_data_dir
|
|
26
27
|
|
|
27
28
|
log = get_logger()
|
|
28
29
|
|
|
@@ -54,7 +55,7 @@ _ACTIONS = {
|
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
def _data_dir() -> Path:
|
|
57
|
-
return
|
|
58
|
+
return default_data_dir()
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
def entitlements_path() -> Path:
|
|
@@ -96,7 +97,7 @@ def journal_identity(doi: str, *, lookup: bool = True) -> dict[str, Any]:
|
|
|
96
97
|
import requests
|
|
97
98
|
|
|
98
99
|
response = requests.get(f"https://api.crossref.org/works/{doi}", timeout=10,
|
|
99
|
-
headers={"User-Agent": "paper-search-
|
|
100
|
+
headers={"User-Agent": "paper-search-school (entitlement memory)"})
|
|
100
101
|
if response.status_code == 200:
|
|
101
102
|
message = response.json().get("message", {})
|
|
102
103
|
identity = {
|
|
@@ -140,7 +140,7 @@ def configured(config: dict[str, Any]) -> Federation | None:
|
|
|
140
140
|
None when none is set, or a route other than one switched on ``without_school``
|
|
141
141
|
has no school saved (a value an old config file may hold)."""
|
|
142
142
|
federation = by_code(config.get("publisher_institution_federation"))
|
|
143
|
-
if federation is None or federation.without_school or str(config.get("
|
|
143
|
+
if federation is None or federation.without_school or str(config.get("school_name") or "").strip():
|
|
144
144
|
return federation
|
|
145
145
|
return None
|
|
146
146
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "incommon",
|
|
3
|
+
"name": "InCommon",
|
|
4
|
+
"country": "US",
|
|
5
|
+
"registration_authorities": ["https://incommon.org"],
|
|
6
|
+
"chooser_labels": ["InCommon Federation"],
|
|
7
|
+
"chooser_pattern": "\\bInCommon\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["incommon.org", "incommonfederation.org"],
|
|
10
|
+
"metadata_url": "https://mdq.incommon.org/entities/exports/edugain"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "infed",
|
|
3
|
+
"name": "INFED",
|
|
4
|
+
"country": "IN",
|
|
5
|
+
"registration_authorities": ["http://inflibnet.ac.in"],
|
|
6
|
+
"chooser_labels": ["INFLIBNET Access Management Federation (INFED)"],
|
|
7
|
+
"chooser_pattern": "\\bINFED\\b|\\bINFLIBNET\\s+Access\\s+Management\\s+Federation\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["inflibnet.ac.in"],
|
|
10
|
+
"metadata_url": "https://parichay.inflibnet.ac.in/metadata/edugain.xml"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "liaf",
|
|
3
|
+
"name": "LIAF",
|
|
4
|
+
"country": "LK",
|
|
5
|
+
"registration_authorities": ["https://liaf.ac.lk"],
|
|
6
|
+
"chooser_labels": ["LEARN Identity Access Federation (LIAF)"],
|
|
7
|
+
"chooser_pattern": "\\bLIAF\\b|\\bLEARN\\s+Identity\\s+(?:and\\s+)?Access\\s+Federation\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["liaf.ac.lk"],
|
|
10
|
+
"metadata_url": "https://fr.ac.lk/signedmetadata/LIAF_to_edugain.xml"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "omren",
|
|
3
|
+
"name": "OMREN",
|
|
4
|
+
"country": "OM",
|
|
5
|
+
"registration_authorities": ["http://www.omren.om"],
|
|
6
|
+
"chooser_labels": ["OMREN Identity Federation"],
|
|
7
|
+
"chooser_pattern": "\\bOMREN\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["fed.omren.om", "federation.omren.om"],
|
|
10
|
+
"metadata_url": "https://fed.omren.om/OMREN_export.xml"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "pkifed",
|
|
3
|
+
"name": "PKIFED",
|
|
4
|
+
"country": "PK",
|
|
5
|
+
"registration_authorities": ["https://pkifed.pk"],
|
|
6
|
+
"chooser_labels": ["Pakistan Identity Federation (PKIFED)"],
|
|
7
|
+
"chooser_pattern": "\\bPKIFED\\b|\\bPakistan\\s+Identity\\s+Federation\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["pkifed.pk"],
|
|
10
|
+
"metadata_url": "https://rr.pern.edu.pk/rr3/signedmetadata/federation/PKIFED_eduGAIN/metadata.xml"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "tigerfed",
|
|
3
|
+
"name": "TIGERfed",
|
|
4
|
+
"country": "BD",
|
|
5
|
+
"registration_authorities": ["https://tigerfed.net.bd"],
|
|
6
|
+
"chooser_labels": ["TIGERfed"],
|
|
7
|
+
"chooser_pattern": "\\bTIGERfed\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["tigerfed.net.bd"],
|
|
10
|
+
"metadata_url": "https://fedmanager.tigerfed.net.bd/edugain-export-metadata.xml"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": "yetkim",
|
|
3
|
+
"name": "YETKİM",
|
|
4
|
+
"country": "TR",
|
|
5
|
+
"registration_authorities": ["https://yetkim.org.tr/"],
|
|
6
|
+
"chooser_labels": ["YETKİM Identity Federation"],
|
|
7
|
+
"chooser_pattern": "\\bYETK[İI]M\\b",
|
|
8
|
+
"discovery_hosts": [],
|
|
9
|
+
"service_domains": ["yetkim.org.tr"],
|
|
10
|
+
"metadata_url": "http://md.yetkim.org.tr/yetkim-upstream.xml"
|
|
11
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Setup saves the school's names, its SAML entityID, the hosts of its login
|
|
4
4
|
pages and the federation it belongs to. The config keys keep their first names
|
|
5
|
-
(``
|
|
5
|
+
(``school_name``, ``school_name_en``): they hold the school of any federation.
|
|
6
6
|
|
|
7
7
|
Finding a school reads only the federations' own data (the user, 2026-11-11):
|
|
8
8
|
CARSI's member list, SeamlessAccess's index of the schools of eduGAIN's
|
|
@@ -67,13 +67,13 @@ class Lookup:
|
|
|
67
67
|
|
|
68
68
|
def names(config: dict[str, Any]) -> tuple[str, ...]:
|
|
69
69
|
"""The saved school's names: as its federation lists it, then in English."""
|
|
70
|
-
found = [str(config.get(key) or "").strip() for key in ("
|
|
70
|
+
found = [str(config.get(key) or "").strip() for key in ("school_name", "school_name_en")]
|
|
71
71
|
return tuple(dict.fromkeys(n for n in found if n))
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
def name(config: dict[str, Any]) -> str:
|
|
75
75
|
"""The saved school's name, typed into choosers ("" when none is saved)."""
|
|
76
|
-
return str(config.get("
|
|
76
|
+
return str(config.get("school_name") or "").strip()
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
def login_hosts(config: dict[str, Any]) -> tuple[str, ...]:
|
|
@@ -140,7 +140,7 @@ def save(config: dict[str, Any], school: School) -> None:
|
|
|
140
140
|
pages = [page for template in (federation.school_login_pages if federation else ())
|
|
141
141
|
for page in ([template.replace("{scope}", scope) for scope in scopes] if "{scope}" in template
|
|
142
142
|
else [template])]
|
|
143
|
-
config.update(
|
|
143
|
+
config.update(school_name=school.name, school_name_en=school.name_en, idp_entity_id=school.entity_id,
|
|
144
144
|
idp_login_hosts=list(school.login_hosts), idp_login_pages=pages,
|
|
145
145
|
idp_domains=[d for d in scopes if "." in d],
|
|
146
146
|
publisher_institution_federation=school.federation, carsi_enabled=school.federation == "carsi")
|
|
@@ -155,8 +155,10 @@ def institutional_configured(config: dict[str, Any]) -> bool:
|
|
|
155
155
|
# --------------------------------------------------------------------------- finding
|
|
156
156
|
|
|
157
157
|
def _key(text: str) -> str:
|
|
158
|
-
"""Case, spaces, hyphens, punctuation and a leading "The" do not count
|
|
159
|
-
|
|
158
|
+
"""Case, spaces, hyphens, punctuation and a leading "The" do not count; "&"
|
|
159
|
+
is "and" (a school listed as "Science & Technology", 2026-11-12)."""
|
|
160
|
+
text = re.sub(r"^the\s+", "", str(text or "").casefold().strip())
|
|
161
|
+
return re.sub(r"[\W_]+", "", text.replace("&", " and "))
|
|
160
162
|
|
|
161
163
|
|
|
162
164
|
def _host(text: str) -> str:
|
|
@@ -180,13 +182,11 @@ class _Found:
|
|
|
180
182
|
self.rows[school.entity_id] = (school, exact)
|
|
181
183
|
|
|
182
184
|
def _primary(self) -> None:
|
|
183
|
-
"""A school also listed in a secondary route (OpenAthens)
|
|
184
|
-
|
|
185
|
+
"""A school also listed in a secondary route (OpenAthens) signs in through
|
|
186
|
+
its federation: that entry goes (``_same_school``)."""
|
|
185
187
|
primary = [s for s, _ in self.rows.values() if not _secondary(s)]
|
|
186
|
-
domains = {d for s in primary for d in s.scopes}
|
|
187
|
-
names = {_key(s.name_en) for s in primary}
|
|
188
188
|
for entity, (school, _) in list(self.rows.items()):
|
|
189
|
-
if _secondary(school) and (
|
|
189
|
+
if _secondary(school) and any(_same_school(school, p) for p in primary):
|
|
190
190
|
del self.rows[entity]
|
|
191
191
|
|
|
192
192
|
def decide(self) -> tuple[School | None, list[School]]:
|
|
@@ -203,6 +203,20 @@ class _Found:
|
|
|
203
203
|
return None, sorted(partial, key=lambda s: (len(s.name), s.name))
|
|
204
204
|
|
|
205
205
|
|
|
206
|
+
def _same_school(other: School, school: School) -> bool:
|
|
207
|
+
"""``other`` is ``school`` listed again: under its domain or a host of it (its
|
|
208
|
+
library's), or under its name, an abbreviation in brackets aside, with a domain
|
|
209
|
+
of the same country (2026-11-12: two countries' universities share a name)."""
|
|
210
|
+
if any(o == d or o.endswith("." + d) for o in other.scopes for d in school.scopes):
|
|
211
|
+
return True
|
|
212
|
+
name = _key(_BRACKET.sub(" ", other.name_en))
|
|
213
|
+
if not name or name != _key(_BRACKET.sub(" ", school.name_en)):
|
|
214
|
+
return False
|
|
215
|
+
if not (other.scopes and school.scopes):
|
|
216
|
+
return True
|
|
217
|
+
return bool({d.rsplit(".", 1)[-1] for d in other.scopes} & {d.rsplit(".", 1)[-1] for d in school.scopes})
|
|
218
|
+
|
|
219
|
+
|
|
206
220
|
def _secondary(school: School) -> bool:
|
|
207
221
|
federation = by_code(school.federation)
|
|
208
222
|
return bool(federation and federation.secondary)
|
|
@@ -213,24 +227,50 @@ _RETIRED = re.compile(r"\bdo not use\b|\btest\b|\blegacy\b", re.I)
|
|
|
213
227
|
|
|
214
228
|
|
|
215
229
|
_PARTS = re.compile(r"\s+[-\u2013\u2014]\s+")
|
|
216
|
-
|
|
230
|
+
_BRACKET = re.compile(r"\(([^()]+)\)")
|
|
231
|
+
# Chinese, Japanese and Korean writing, beside a name in Latin letters.
|
|
232
|
+
_CJK = re.compile(r"[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af][\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\s・·]*")
|
|
217
233
|
|
|
218
234
|
|
|
219
235
|
def _names(titles: Iterable[str]) -> list[str]:
|
|
220
236
|
"""The names a school is listed under, and their parts: "NHU - National
|
|
221
237
|
Harbour University" (an abbreviation before the name), "北大学 (Kita
|
|
222
|
-
University) – OpenAthens" (a second name in brackets, the route after a dash)
|
|
238
|
+
University) – OpenAthens" (a second name in brackets, the route after a dash),
|
|
239
|
+
"National Harbour Bay University (NHBU) 海灣大學" (brackets inside, and a name in
|
|
240
|
+
another script beside the English one: OpenAthens in Taiwan, 2026-11-12)."""
|
|
223
241
|
names = [str(t).strip() for t in titles if str(t or "").strip()]
|
|
224
242
|
found = list(names)
|
|
225
243
|
for name in names:
|
|
226
244
|
for part in _PARTS.split(name):
|
|
227
|
-
|
|
228
|
-
|
|
245
|
+
part = part.strip()
|
|
246
|
+
outside = re.sub(r"\s+", " ", _BRACKET.sub(" ", part)).strip()
|
|
247
|
+
found += [part, outside, *(m.strip() for m in _BRACKET.findall(part))]
|
|
248
|
+
if _CJK.search(outside) and re.search(r"[A-Za-z]{2}", _CJK.sub(" ", outside)):
|
|
249
|
+
found += [m.strip() for m in _CJK.findall(outside)] + [re.sub(r"\s+", " ", _CJK.sub(" ", outside)).strip()]
|
|
229
250
|
return list(dict.fromkeys(n for n in found if n))
|
|
230
251
|
|
|
231
252
|
|
|
253
|
+
def _words(text: str) -> list[str]:
|
|
254
|
+
"""The words of a name, as ``_key`` compares them."""
|
|
255
|
+
words = [w for w in re.split(r"[\W_]+", str(text or "").casefold().replace("&", " and ")) if w]
|
|
256
|
+
return words[1:] if words[:1] == ["the"] else words
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def _listed_inside(text: str, listed_names: Iterable[str]) -> bool:
|
|
260
|
+
"""A listed name of two words or more found word for word in what was given:
|
|
261
|
+
a school listed shorter than its full name ("Kita Bay" for "Kita Bay
|
|
262
|
+
University", 2026-11-12), only ever asked about."""
|
|
263
|
+
given = _words(text)
|
|
264
|
+
for name in listed_names:
|
|
265
|
+
part = _words(name)
|
|
266
|
+
if len(part) >= 2 and any(given[i:i + len(part)] == part for i in range(len(given) - len(part) + 1)):
|
|
267
|
+
return True
|
|
268
|
+
return False
|
|
269
|
+
|
|
270
|
+
|
|
232
271
|
def _matches(given: Iterable[str], listed_names: Iterable[str], scopes: Iterable[str], entity: str) -> tuple[bool, bool]:
|
|
233
272
|
"""(exact, partial) for what was given against one listed school."""
|
|
273
|
+
listed_names = list(listed_names)
|
|
234
274
|
keys = {_key(n) for n in listed_names} - {""}
|
|
235
275
|
hosts = {s.lower() for s in scopes if s}
|
|
236
276
|
exact = partial = False
|
|
@@ -240,12 +280,13 @@ def _matches(given: Iterable[str], listed_names: Iterable[str], scopes: Iterable
|
|
|
240
280
|
continue
|
|
241
281
|
if text == entity or key in keys or host in hosts:
|
|
242
282
|
exact = True
|
|
243
|
-
elif any(key in k for k in keys) or any(host and host in h for h in hosts)
|
|
283
|
+
elif (any(key in k for k in keys) or any(host and host in h for h in hosts)
|
|
284
|
+
or _listed_inside(text, listed_names)):
|
|
244
285
|
partial = True
|
|
245
286
|
return exact, partial and not exact
|
|
246
287
|
|
|
247
288
|
|
|
248
|
-
def
|
|
289
|
+
def _from_school_list(given: list[str], config: dict[str, Any], data_dir: Path, found: _Found, lookup: Lookup) -> None:
|
|
249
290
|
from ..carsi_schools import find_schools, load_school_list
|
|
250
291
|
|
|
251
292
|
try:
|
|
@@ -383,7 +424,7 @@ def find(query: str, config: dict[str, Any], data_dir: Path, *, also: Iterable[s
|
|
|
383
424
|
lookup, found = Lookup(), _Found()
|
|
384
425
|
if not given:
|
|
385
426
|
return lookup
|
|
386
|
-
|
|
427
|
+
_from_school_list(given, config, data_dir, found, lookup)
|
|
387
428
|
_from_seamlessaccess(given, config, found, lookup, carsi_listed="CARSI" not in lookup.unavailable)
|
|
388
429
|
if "SeamlessAccess" in lookup.unavailable:
|
|
389
430
|
_from_metadata(given, config, data_dir, found, lookup)
|
|
@@ -8,7 +8,7 @@ publisher, phase, latest live-preview screenshots) and marked
|
|
|
8
8
|
(``engine/batch_user.py``): it adds the live page (URL, title, text
|
|
9
9
|
excerpt, screenshots of every tab, recent events), does what the kind of
|
|
10
10
|
report asks and records the outcome under ``handled``. Reports stay "open"
|
|
11
|
-
until reviewed: ``paper-search-
|
|
11
|
+
until reviewed: ``paper-search-school issues``.
|
|
12
12
|
"""
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
@@ -21,6 +21,7 @@ import time
|
|
|
21
21
|
from datetime import datetime
|
|
22
22
|
from pathlib import Path
|
|
23
23
|
from typing import Any
|
|
24
|
+
from .data_home import default_data_dir
|
|
24
25
|
|
|
25
26
|
ISSUE_KINDS: dict[str, str] = {
|
|
26
27
|
"pdf_not_captured": "PDF 已打开,但没保存",
|
|
@@ -35,7 +36,7 @@ CAPTURE_WINDOW_SEC = 30 * 60
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
def _data_dir() -> Path:
|
|
38
|
-
return
|
|
39
|
+
return default_data_dir()
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
def issues_dir() -> Path:
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
"""Logging setup for the
|
|
1
|
+
"""Logging setup for the school subscription download backend. Routes to stderr to avoid corrupting MCP stdio."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
6
|
import sys
|
|
7
|
+
from .data_home import default_data_dir
|
|
7
8
|
|
|
8
9
|
_logger: logging.Logger | None = None
|
|
9
10
|
_stack_file = None
|
|
@@ -15,10 +16,10 @@ def _file_handler() -> logging.Handler | None:
|
|
|
15
16
|
from datetime import date
|
|
16
17
|
from pathlib import Path
|
|
17
18
|
|
|
18
|
-
if os.environ.get("
|
|
19
|
+
if os.environ.get("SCHOOL_FILE_LOG") == "0":
|
|
19
20
|
return None
|
|
20
21
|
try:
|
|
21
|
-
data_dir =
|
|
22
|
+
data_dir = default_data_dir()
|
|
22
23
|
log_dir = data_dir / "logs"
|
|
23
24
|
log_dir.mkdir(parents=True, exist_ok=True)
|
|
24
25
|
handler = logging.FileHandler(log_dir / f"backend-{date.today().isoformat()}.log", encoding="utf-8")
|
|
@@ -38,10 +39,10 @@ def enable_stack_dump() -> None:
|
|
|
38
39
|
from datetime import date
|
|
39
40
|
from pathlib import Path
|
|
40
41
|
|
|
41
|
-
if _stack_file is not None or os.environ.get("
|
|
42
|
+
if _stack_file is not None or os.environ.get("SCHOOL_FILE_LOG") == "0":
|
|
42
43
|
return
|
|
43
44
|
try:
|
|
44
|
-
log_dir =
|
|
45
|
+
log_dir = default_data_dir() / "logs"
|
|
45
46
|
log_dir.mkdir(parents=True, exist_ok=True)
|
|
46
47
|
_stack_file = open(log_dir / f"stacks-{date.today().isoformat()}.txt", "a", encoding="utf-8")
|
|
47
48
|
except OSError:
|
|
@@ -78,7 +79,7 @@ def dump_stacks(reason: str) -> bool:
|
|
|
78
79
|
def get_logger() -> logging.Logger:
|
|
79
80
|
global _logger
|
|
80
81
|
if _logger is None:
|
|
81
|
-
_logger = logging.getLogger("
|
|
82
|
+
_logger = logging.getLogger("paper_search_school")
|
|
82
83
|
if not _logger.handlers:
|
|
83
84
|
handler = logging.StreamHandler(sys.stderr)
|
|
84
85
|
handler.setFormatter(logging.Formatter("[%(levelname)s] %(message)s"))
|
|
@@ -25,7 +25,7 @@ def ledger_path() -> Path:
|
|
|
25
25
|
|
|
26
26
|
def school_key(config: dict[str, Any]) -> str:
|
|
27
27
|
"""The configured school: its entityID, else its CARSI name; "" without one."""
|
|
28
|
-
for field in ("idp_entity_id", "
|
|
28
|
+
for field in ("idp_entity_id", "school_name", "school_name_en"):
|
|
29
29
|
value = " ".join(str(config.get(field) or "").split())
|
|
30
30
|
if value:
|
|
31
31
|
return value.lower()
|
|
@@ -53,14 +53,14 @@ _thread_local = threading.local()
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def configured_proxy(config: dict[str, Any] | None = None) -> str:
|
|
56
|
-
"""The one explicit proxy setting:
|
|
56
|
+
"""The one explicit proxy setting: SCHOOL_PROXY env > network_proxy config.
|
|
57
57
|
|
|
58
58
|
HTTP_PROXY/HTTPS_PROXY are ignored: sessions run trust_env=False, and the
|
|
59
59
|
package __init__ adds NO_PROXY='*' only in the IDE-proxy situation it was
|
|
60
60
|
written for. Campus-bound traffic (Elsevier/Springer TDM entitlement is
|
|
61
61
|
IP-based) must go through THIS setting or it egresses off-campus.
|
|
62
62
|
"""
|
|
63
|
-
return os.environ.get("
|
|
63
|
+
return os.environ.get("SCHOOL_PROXY") or (config or {}).get("network_proxy") or ""
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
def _new_pooled_session(proxies: dict[str, str] | None) -> requests.Session:
|
|
@@ -136,7 +136,7 @@ def _download_impl(doi: str, output_dir: str | Path | None, *,
|
|
|
136
136
|
cached = {**cached, "supplements": extra["supplements"]}
|
|
137
137
|
return cached
|
|
138
138
|
|
|
139
|
-
log.info(f"paper-search-
|
|
139
|
+
log.info(f"paper-search-school - {doi}")
|
|
140
140
|
|
|
141
141
|
try:
|
|
142
142
|
result = try_institutional(doi, output_path, config)
|