papersearch 0.6.11 → 0.7.0
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/LICENSE +661 -21
- package/NOTICE +51 -0
- package/README.en.md +13 -13
- package/README.md +13 -13
- package/assets/federation-map.en.png +0 -0
- package/assets/federation-map.png +0 -0
- package/dist/capabilities/{pdf-discovery → download/batch}/batch.d.ts +24 -16
- package/dist/capabilities/download/batch/batch.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/batch}/batch.js +416 -286
- package/dist/capabilities/download/batch/batch.js.map +1 -0
- package/dist/capabilities/download/batch/batchFolder.d.ts +21 -0
- package/dist/capabilities/download/batch/batchFolder.d.ts.map +1 -0
- package/dist/capabilities/download/batch/batchFolder.js +206 -0
- package/dist/capabilities/download/batch/batchFolder.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/batch}/batchPapers.d.ts +1 -1
- package/dist/capabilities/download/batch/batchPapers.d.ts.map +1 -0
- package/dist/capabilities/download/batch/batchPapers.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/batch}/batchSummary.d.ts +4 -8
- package/dist/capabilities/download/batch/batchSummary.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/batch}/batchSummary.js +91 -32
- package/dist/capabilities/download/batch/batchSummary.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/batch}/networkLoss.d.ts +1 -1
- package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -0
- package/dist/capabilities/download/batch/networkLoss.js.map +1 -0
- package/dist/capabilities/download/batch/resume.d.ts +76 -0
- package/dist/capabilities/download/batch/resume.d.ts.map +1 -0
- package/dist/capabilities/download/batch/resume.js +231 -0
- package/dist/capabilities/download/batch/resume.js.map +1 -0
- package/dist/capabilities/download/content/markdown/pageVisit.d.ts +14 -0
- package/dist/capabilities/download/content/markdown/pageVisit.d.ts.map +1 -0
- package/dist/capabilities/download/content/markdown/pageVisit.js +52 -0
- package/dist/capabilities/download/content/markdown/pageVisit.js.map +1 -0
- package/dist/capabilities/download/content/markdown/pro.d.ts +87 -0
- package/dist/capabilities/download/content/markdown/pro.d.ts.map +1 -0
- package/dist/capabilities/download/content/markdown/pro.js +109 -0
- package/dist/capabilities/download/content/markdown/pro.js.map +1 -0
- package/dist/capabilities/download/content/markdown/shortfall.d.ts +34 -0
- package/dist/capabilities/download/content/markdown/shortfall.d.ts.map +1 -0
- package/dist/capabilities/download/content/markdown/shortfall.js +99 -0
- package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -0
- package/dist/capabilities/download/content/markdown/stats.d.ts +9 -0
- package/dist/capabilities/download/content/markdown/stats.d.ts.map +1 -0
- package/dist/capabilities/download/content/markdown/stats.js +39 -0
- package/dist/capabilities/download/content/markdown/stats.js.map +1 -0
- package/dist/capabilities/download/content/markdown/step.d.ts +50 -0
- package/dist/capabilities/download/content/markdown/step.d.ts.map +1 -0
- package/dist/capabilities/download/content/markdown/step.js +343 -0
- package/dist/capabilities/download/content/markdown/step.js.map +1 -0
- package/dist/capabilities/download/content/markdown/types.d.ts +120 -0
- package/dist/capabilities/download/content/markdown/types.d.ts.map +1 -0
- package/dist/capabilities/download/content/markdown/types.js +8 -0
- package/dist/capabilities/download/content/markdown/types.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf}/DownloadTier.d.ts +13 -4
- package/dist/capabilities/download/content/pdf/DownloadTier.d.ts.map +1 -0
- package/dist/capabilities/download/content/pdf/DownloadTier.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf}/OpenAccessFallbackService.d.ts +5 -5
- package/dist/capabilities/download/content/pdf/OpenAccessFallbackService.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf}/OpenAccessFallbackService.js +24 -13
- package/dist/capabilities/download/content/pdf/OpenAccessFallbackService.js.map +1 -0
- package/dist/capabilities/download/content/pdf/arxiv.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf}/arxiv.js +2 -2
- package/dist/capabilities/download/content/pdf/arxiv.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf}/identity.d.ts +1 -1
- package/dist/capabilities/download/content/pdf/identity.d.ts.map +1 -0
- package/dist/capabilities/download/content/pdf/identity.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/oaHosts.d.ts.map +1 -0
- package/dist/capabilities/download/content/pdf/open/oaHosts.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/pmcCloud.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/pmcCloud.js +2 -2
- package/dist/capabilities/download/content/pdf/open/pmcCloud.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/publisherApi/elsevier.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/publisherApi/elsevier.js +3 -3
- package/dist/capabilities/download/content/pdf/open/publisherApi/elsevier.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/publisherApi/index.d.ts.map +1 -0
- package/dist/capabilities/download/content/pdf/open/publisherApi/index.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/publisherApi/springer.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/publisherApi/springer.js +3 -3
- package/dist/capabilities/download/content/pdf/open/publisherApi/springer.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/directPdfUrl.d.ts +5 -0
- package/dist/capabilities/download/content/pdf/open/tiers/directPdfUrl.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/directPdfUrl.js +3 -3
- package/dist/capabilities/download/content/pdf/open/tiers/directPdfUrl.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/preprint.d.ts +5 -0
- package/dist/capabilities/download/content/pdf/open/tiers/preprint.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/preprint.js +5 -5
- package/dist/capabilities/download/content/pdf/open/tiers/preprint.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/primary.d.ts +3 -0
- package/dist/capabilities/download/content/pdf/open/tiers/primary.d.ts.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/primary.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/publisherApi.d.ts +1 -1
- package/dist/capabilities/download/content/pdf/open/tiers/publisherApi.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/publisherApi.js +5 -5
- package/dist/capabilities/download/content/pdf/open/tiers/publisherApi.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/repositories.d.ts +1 -1
- package/dist/capabilities/download/content/pdf/open/tiers/repositories.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/repositories.js +2 -2
- package/dist/capabilities/download/content/pdf/open/tiers/repositories.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/scihub.d.ts +3 -0
- package/dist/capabilities/download/content/pdf/open/tiers/scihub.d.ts.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/scihub.js.map +1 -0
- package/dist/capabilities/download/content/pdf/open/tiers/unpaywall.d.ts +3 -0
- package/dist/capabilities/download/content/pdf/open/tiers/unpaywall.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/unpaywall.js +2 -2
- package/dist/capabilities/download/content/pdf/open/tiers/unpaywall.js.map +1 -0
- package/dist/capabilities/download/content/pdf/school.d.ts +4 -0
- package/dist/capabilities/download/content/pdf/school.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery/tiers/entitledAccess.js → download/content/pdf/school.js} +16 -40
- package/dist/capabilities/download/content/pdf/school.js.map +1 -0
- package/dist/capabilities/download/content/supplements/fetch.d.ts +27 -0
- package/dist/capabilities/download/content/supplements/fetch.d.ts.map +1 -0
- package/dist/capabilities/download/content/supplements/fetch.js +150 -0
- package/dist/capabilities/download/content/supplements/fetch.js.map +1 -0
- package/dist/capabilities/download/content/supplements/shortfall.d.ts +11 -0
- package/dist/capabilities/download/content/supplements/shortfall.d.ts.map +1 -0
- package/dist/capabilities/download/content/supplements/shortfall.js +24 -0
- package/dist/capabilities/download/content/supplements/shortfall.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download}/handler.d.ts +12 -4
- package/dist/capabilities/download/handler.d.ts.map +1 -0
- package/dist/capabilities/download/handler.js +275 -0
- package/dist/capabilities/download/handler.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download}/index.d.ts +3 -3
- package/dist/capabilities/download/index.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download}/index.js +2 -2
- package/dist/capabilities/download/index.js.map +1 -0
- package/dist/capabilities/download/outputLayout.d.ts.map +1 -0
- package/dist/capabilities/{pdf-discovery → download}/outputLayout.js +63 -6
- package/dist/capabilities/download/outputLayout.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download}/schemas.d.ts +143 -18
- package/dist/capabilities/download/schemas.d.ts.map +1 -0
- package/dist/capabilities/download/schemas.js +126 -0
- package/dist/capabilities/download/schemas.js.map +1 -0
- package/dist/capabilities/{pdf-discovery → download}/tools.d.ts +68 -6
- package/dist/capabilities/download/tools.d.ts.map +1 -0
- package/dist/capabilities/download/tools.js +197 -0
- package/dist/capabilities/download/tools.js.map +1 -0
- package/dist/capabilities/download/types.d.ts +222 -0
- package/dist/capabilities/download/types.d.ts.map +1 -0
- package/dist/capabilities/download/types.js +7 -0
- package/dist/capabilities/download/types.js.map +1 -0
- package/dist/cli.js +98 -17
- package/dist/cli.js.map +1 -1
- package/dist/config/edition.d.ts +8 -0
- package/dist/config/edition.d.ts.map +1 -0
- package/dist/config/edition.js +31 -0
- package/dist/config/edition.js.map +1 -0
- package/dist/core/handleToolCall.d.ts +1 -1
- package/dist/core/handleToolCall.d.ts.map +1 -1
- package/dist/core/handleToolCall.js +1 -1
- package/dist/core/handleToolCall.js.map +1 -1
- package/dist/core/schemas.d.ts +1 -1
- package/dist/core/schemas.d.ts.map +1 -1
- package/dist/core/schemas.js +1 -1
- package/dist/core/schemas.js.map +1 -1
- package/dist/core/tools.d.ts +2 -1
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/core/tools.js +8 -2
- package/dist/core/tools.js.map +1 -1
- package/dist/infrastructure/pdf/PdfIdentity.d.ts.map +1 -1
- package/dist/infrastructure/pdf/PdfIdentity.js +76 -5
- package/dist/infrastructure/pdf/PdfIdentity.js.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.d.ts +12 -2
- package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.js +39 -11
- package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts +9 -6
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +81 -43
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolAttempt.js +10 -3
- package/dist/infrastructure/school/SchoolAttempt.js.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolMcpClient.d.ts +17 -0
- package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolMcpClient.js +99 -10
- package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolProgress.d.ts +1 -0
- package/dist/infrastructure/school/SchoolProgress.d.ts.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolProgress.js +1 -0
- package/dist/infrastructure/school/SchoolProgress.js.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolReadiness.d.ts +7 -1
- package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolReadiness.js +10 -2
- package/dist/infrastructure/school/SchoolReadiness.js.map +1 -0
- package/dist/infrastructure/school/SchoolResultNormalizer.d.ts.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolResultNormalizer.js +72 -3
- package/dist/infrastructure/school/SchoolResultNormalizer.js.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/index.d.ts +2 -1
- package/dist/infrastructure/school/index.d.ts.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/index.js +3 -2
- package/dist/infrastructure/school/index.js.map +1 -0
- package/dist/{capabilities/pdf-discovery → infrastructure}/school/types.d.ts +78 -3
- package/dist/infrastructure/school/types.d.ts.map +1 -0
- package/dist/infrastructure/school/types.js +5 -0
- package/dist/infrastructure/school/types.js.map +1 -0
- package/dist/management/capability-profile/schoolReadiness.d.ts +1 -1
- package/dist/management/capability-profile/schoolReadiness.d.ts.map +1 -1
- package/dist/management/capability-profile/schoolReadiness.js +1 -1
- package/dist/management/capability-profile/schoolReadiness.js.map +1 -1
- package/dist/management/failures/exportReport.d.ts +6 -0
- package/dist/management/failures/exportReport.d.ts.map +1 -1
- package/dist/management/failures/exportReport.js +28 -18
- package/dist/management/failures/exportReport.js.map +1 -1
- package/dist/management/failures/index.d.ts +3 -0
- package/dist/management/failures/index.d.ts.map +1 -1
- package/dist/management/failures/index.js +5 -2
- package/dist/management/failures/index.js.map +1 -1
- package/dist/management/failures/markdownReport.d.ts +55 -0
- package/dist/management/failures/markdownReport.d.ts.map +1 -0
- package/dist/management/failures/markdownReport.js +96 -0
- package/dist/management/failures/markdownReport.js.map +1 -0
- package/dist/management/pro/install.d.ts +58 -0
- package/dist/management/pro/install.d.ts.map +1 -0
- package/dist/management/pro/install.js +235 -0
- package/dist/management/pro/install.js.map +1 -0
- package/dist/management/reports/index.d.ts.map +1 -1
- package/dist/management/reports/index.js +4 -1
- package/dist/management/reports/index.js.map +1 -1
- package/dist/management/school/autoUpdate.d.ts +4 -3
- package/dist/management/school/autoUpdate.d.ts.map +1 -1
- package/dist/management/school/autoUpdate.js +6 -4
- package/dist/management/school/autoUpdate.js.map +1 -1
- package/dist/management/school/cliProgress.d.ts +1 -1
- package/dist/management/school/cliProgress.d.ts.map +1 -1
- package/dist/management/school/cliProgress.js +1 -0
- package/dist/management/school/cliProgress.js.map +1 -1
- package/dist/management/school/host.js +1 -1
- package/dist/management/school/host.js.map +1 -1
- package/dist/management/school/installer.d.ts +1 -2
- package/dist/management/school/installer.d.ts.map +1 -1
- package/dist/management/school/installer.js.map +1 -1
- package/dist/management/school/legacy.js +1 -1
- package/dist/management/school/legacy.js.map +1 -1
- package/dist/management/school/settingsWindow.d.ts +14 -3
- package/dist/management/school/settingsWindow.d.ts.map +1 -1
- package/dist/management/school/settingsWindow.js +14 -4
- package/dist/management/school/settingsWindow.js.map +1 -1
- package/dist/management/skills/autoSync.d.ts +3 -3
- package/dist/management/skills/autoSync.d.ts.map +1 -1
- package/dist/management/skills/autoSync.js +13 -20
- package/dist/management/skills/autoSync.js.map +1 -1
- package/dist/services/OpenAccessFallbackService.d.ts +3 -3
- package/dist/services/OpenAccessFallbackService.d.ts.map +1 -1
- package/dist/services/OpenAccessFallbackService.js +1 -1
- package/dist/services/OpenAccessFallbackService.js.map +1 -1
- package/dist/skills/SkillInstaller.d.ts +26 -0
- package/dist/skills/SkillInstaller.d.ts.map +1 -1
- package/dist/skills/SkillInstaller.js +80 -10
- package/dist/skills/SkillInstaller.js.map +1 -1
- package/package.json +10 -2
- package/school/LICENSE +661 -21
- package/school/LICENSE-scansci-pdf +21 -0
- package/school/NOTICE +10 -0
- package/school/README.md +1 -1
- package/school/paper_search_school/_core/__init__.py +2 -1
- package/school/paper_search_school/adapters/__init__.py +3 -3
- package/school/paper_search_school/adapters/acm/__init__.py +7 -1
- package/school/paper_search_school/adapters/acs/__init__.py +4 -0
- package/school/paper_search_school/adapters/aha_journals/__init__.py +5 -1
- package/school/paper_search_school/adapters/aip/__init__.py +17 -0
- package/school/paper_search_school/adapters/ams/__init__.py +36 -0
- package/school/paper_search_school/adapters/annual_reviews/__init__.py +24 -1
- package/school/paper_search_school/adapters/aps/__init__.py +118 -0
- package/school/paper_search_school/adapters/asce/__init__.py +7 -1
- package/school/paper_search_school/adapters/base.py +21 -1
- package/school/paper_search_school/adapters/bmj/__init__.py +54 -0
- package/school/paper_search_school/adapters/copernicus/__init__.py +35 -0
- package/school/paper_search_school/adapters/dovepress/__init__.py +31 -0
- package/school/paper_search_school/adapters/elsevier/__init__.py +33 -0
- package/school/paper_search_school/adapters/frontiers/__init__.py +46 -1
- package/school/paper_search_school/adapters/ieee/__init__.py +94 -2
- package/school/paper_search_school/adapters/iop/__init__.py +65 -0
- package/school/paper_search_school/adapters/jama/__init__.py +4 -0
- package/school/paper_search_school/adapters/karger/__init__.py +6 -1
- package/school/paper_search_school/adapters/lww/__init__.py +3 -0
- package/school/paper_search_school/adapters/lww/ovid.py +28 -0
- package/school/paper_search_school/adapters/mdpi/__init__.py +73 -0
- package/school/paper_search_school/adapters/nejm/__init__.py +5 -1
- package/school/paper_search_school/adapters/neurology/__init__.py +5 -1
- package/school/paper_search_school/adapters/optica/__init__.py +49 -0
- package/school/paper_search_school/adapters/oup/__init__.py +34 -2
- package/school/paper_search_school/adapters/platforms/atypon/__init__.py +83 -2
- package/school/paper_search_school/adapters/platforms/figshare/__init__.py +0 -3
- package/school/paper_search_school/adapters/platforms/silverchair/__init__.py +76 -0
- package/school/paper_search_school/adapters/plos/__init__.py +85 -2
- package/school/paper_search_school/adapters/pnas/__init__.py +5 -1
- package/school/paper_search_school/adapters/royal_society/__init__.py +17 -0
- package/school/paper_search_school/adapters/rsc/__init__.py +4 -1
- package/school/paper_search_school/adapters/sage/__init__.py +6 -0
- package/school/paper_search_school/adapters/science/__init__.py +5 -1
- package/school/paper_search_school/adapters/springer/__init__.py +102 -0
- package/school/paper_search_school/adapters/taylor_francis/__init__.py +11 -1
- package/school/paper_search_school/adapters/thieme/__init__.py +46 -0
- package/school/paper_search_school/adapters/wiley/__init__.py +28 -0
- package/school/paper_search_school/adapters/world_scientific/__init__.py +15 -4
- package/school/paper_search_school/assets/capsule.html +599 -38
- package/school/paper_search_school/assets/capsule_en.json +309 -7
- package/school/paper_search_school/browser/__init__.py +5 -2
- package/school/paper_search_school/browser/backend.py +161 -9
- package/school/paper_search_school/browser/batch_session.py +76 -2
- package/school/paper_search_school/browser/challenge/__init__.py +13 -0
- package/school/paper_search_school/browser/{challenges.py → challenge/detection.py} +1 -1
- package/school/paper_search_school/browser/{challenge_interaction.py → challenge/interaction.py} +92 -19
- package/school/paper_search_school/browser/challenge/pointer.py +228 -0
- package/school/paper_search_school/browser/challenge/prompt.py +154 -0
- package/school/paper_search_school/browser/challenge/warmup.py +90 -0
- package/school/paper_search_school/browser/driver.py +12 -0
- package/school/paper_search_school/browser/profiles.py +54 -3
- package/school/paper_search_school/browser/watchdog.py +8 -0
- package/school/paper_search_school/cli.py +150 -10
- package/school/paper_search_school/cold_start.py +5 -2
- package/school/paper_search_school/config.py +25 -1
- package/school/paper_search_school/download_diagnostics.py +2 -1
- package/school/paper_search_school/edition.py +22 -0
- package/school/paper_search_school/engine/access_rules.py +62 -2
- package/school/paper_search_school/engine/batch.py +56 -12
- package/school/paper_search_school/engine/batch_access.py +12 -1
- package/school/paper_search_school/engine/batch_capture.py +309 -9
- package/school/paper_search_school/engine/batch_common.py +3 -1
- package/school/paper_search_school/engine/batch_institution.py +145 -21
- package/school/paper_search_school/engine/batch_login.py +554 -21
- package/school/paper_search_school/engine/batch_waits.py +76 -1
- package/school/paper_search_school/engine/bridge.py +118 -7
- package/school/paper_search_school/engine/fulltext_page.py +340 -0
- package/school/paper_search_school/engine/pdf_guard.py +65 -5
- package/school/paper_search_school/engine/router.py +3 -2
- package/school/paper_search_school/engine/supplement_transfer.py +22 -7
- package/school/paper_search_school/engine/supplements.py +5 -8
- package/school/paper_search_school/federations/__init__.py +9 -6
- package/school/paper_search_school/{carsi_schools.py → federations/carsi.py} +1 -1
- package/school/paper_search_school/federations/{builtin → data/asia}/cstcloud.json +2 -2
- package/school/paper_search_school/federations/{builtin → data/europe}/eduidhu.json +2 -2
- package/school/paper_search_school/login_routes.py +45 -0
- package/school/paper_search_school/markdown_report.py +426 -0
- package/school/paper_search_school/orchestrator.py +25 -1
- package/school/paper_search_school/pro_status.py +192 -0
- package/school/paper_search_school/progress_capsule.py +192 -2
- package/school/paper_search_school/progress_reporter.py +92 -14
- package/school/paper_search_school/progress_status.py +1 -1
- package/school/paper_search_school/progress_view.py +148 -28
- package/school/paper_search_school/publishers/profiles.py +6 -0
- package/school/paper_search_school/rate_limit.py +7 -0
- package/school/paper_search_school/report_sanitizer.py +25 -11
- package/school/paper_search_school/school_login.py +373 -0
- package/school/paper_search_school/schools/__init__.py +7 -0
- package/school/paper_search_school/{federations/schools.py → schools/lookup.py} +3 -3
- package/school/paper_search_school/schools/saved.py +111 -0
- package/school/paper_search_school/server.py +53 -9
- package/school/paper_search_school/user_settings.py +14 -0
- package/school/pyproject.toml +3 -2
- package/skills/paper-search/SKILL.md +11 -12
- package/skills/paper-search/references/browser-download.md +19 -15
- package/skills/paper-search/references/capability-routing.md +1 -1
- package/skills/paper-search/references/cli-contract.md +7 -5
- package/skills/paper-search/references/management-layer.md +3 -3
- package/skills/paper-search/references/publisher-support.md +5 -5
- package/skills/paper-search/references/school-setup.md +14 -0
- package/skills/paper-search/references/troubleshooting.md +0 -1
- package/assets/ask-with-skill.png +0 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/DownloadTier.js.map +0 -1
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js.map +0 -1
- package/dist/capabilities/pdf-discovery/arxiv.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/arxiv.js.map +0 -1
- package/dist/capabilities/pdf-discovery/batch.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/batch.js.map +0 -1
- package/dist/capabilities/pdf-discovery/batchPapers.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/batchPapers.js.map +0 -1
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/batchSummary.js.map +0 -1
- package/dist/capabilities/pdf-discovery/handler.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/handler.js +0 -166
- package/dist/capabilities/pdf-discovery/handler.js.map +0 -1
- package/dist/capabilities/pdf-discovery/identity.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/identity.js.map +0 -1
- package/dist/capabilities/pdf-discovery/index.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/index.js.map +0 -1
- package/dist/capabilities/pdf-discovery/networkLoss.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/networkLoss.js.map +0 -1
- package/dist/capabilities/pdf-discovery/oaHosts.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/oaHosts.js.map +0 -1
- package/dist/capabilities/pdf-discovery/outputLayout.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/outputLayout.js.map +0 -1
- package/dist/capabilities/pdf-discovery/pmcCloud.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/pmcCloud.js.map +0 -1
- package/dist/capabilities/pdf-discovery/publisherApi/elsevier.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/publisherApi/elsevier.js.map +0 -1
- package/dist/capabilities/pdf-discovery/publisherApi/index.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/publisherApi/index.js.map +0 -1
- package/dist/capabilities/pdf-discovery/publisherApi/springer.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/publisherApi/springer.js.map +0 -1
- package/dist/capabilities/pdf-discovery/resume.d.ts +0 -22
- package/dist/capabilities/pdf-discovery/resume.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/resume.js +0 -124
- package/dist/capabilities/pdf-discovery/resume.js.map +0 -1
- package/dist/capabilities/pdf-discovery/schemas.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/schemas.js +0 -75
- package/dist/capabilities/pdf-discovery/schemas.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolProgress.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolProgress.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolReadiness.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolReadiness.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolResultNormalizer.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/SchoolResultNormalizer.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/index.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/index.js.map +0 -1
- package/dist/capabilities/pdf-discovery/school/types.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/school/types.js +0 -2
- package/dist/capabilities/pdf-discovery/school/types.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.d.ts +0 -5
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.d.ts +0 -10
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/preprint.d.ts +0 -5
- package/dist/capabilities/pdf-discovery/tiers/preprint.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/preprint.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/primary.d.ts +0 -3
- package/dist/capabilities/pdf-discovery/tiers/primary.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/primary.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/publisherApi.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/publisherApi.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/repositories.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/repositories.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/scihub.d.ts +0 -3
- package/dist/capabilities/pdf-discovery/tiers/scihub.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/scihub.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.d.ts +0 -3
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.js.map +0 -1
- package/dist/capabilities/pdf-discovery/tools.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/tools.js +0 -146
- package/dist/capabilities/pdf-discovery/tools.js.map +0 -1
- package/dist/capabilities/pdf-discovery/types.d.ts +0 -102
- package/dist/capabilities/pdf-discovery/types.d.ts.map +0 -1
- package/dist/capabilities/pdf-discovery/types.js +0 -2
- package/dist/capabilities/pdf-discovery/types.js.map +0 -1
- /package/dist/capabilities/{pdf-discovery → download/batch}/batchPapers.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/batch}/networkLoss.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf}/DownloadTier.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf}/arxiv.d.ts +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf}/identity.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/oaHosts.d.ts +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/oaHosts.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/pmcCloud.d.ts +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/publisherApi/elsevier.d.ts +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/publisherApi/index.d.ts +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/publisherApi/index.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/publisherApi/springer.d.ts +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/primary.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download/content/pdf/open}/tiers/scihub.js +0 -0
- /package/dist/capabilities/{pdf-discovery → download}/outputLayout.d.ts +0 -0
- /package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolAttempt.d.ts +0 -0
- /package/dist/{capabilities/pdf-discovery → infrastructure}/school/SchoolResultNormalizer.d.ts +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/eduidbf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/eduidma.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/eduidtg.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/fidern.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/garnet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/maren.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/ngrenid.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/rafiki.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/rif.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/safire.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/africa}/ternet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/caf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/cafe.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/cofre.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/colfire.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/fenix.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/incommon.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/americas}/minga.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/azsciencenet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/carsi.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/cynet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/gakunin.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/hkaf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/infed.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/irfed.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/iucc.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/kafe.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/liaf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/maeen.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/omren.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/pkifed.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/sgaf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/sifulan.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/tigerfed.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/asia}/yetkim.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/aaieduhr.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/aaiedumk.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/aconet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/arnesaai.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/belnet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/bif.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/dfnaai.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/edugate.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/eduidcz.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/eduidlu.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/febas.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/feide.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/grnet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/haka.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/iamres.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/idedume.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/idem.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/laife.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/leaf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/litnet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/peano.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/pionierid.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/rash.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/rctsaai.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/renater.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/ricerkanet.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/roedunetid.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/safeid.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/sir.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/surfconext.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/swamid.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/switchaai.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/taat.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/ukfederation.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/europe}/wayf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/global}/openathens.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/oceania}/aaf.json +0 -0
- /package/school/paper_search_school/federations/{builtin → data/oceania}/tuakiri.json +0 -0
|
@@ -5,6 +5,7 @@ Part of ``PublisherBatchDownloader`` (batch.py), which combines the mixins."""
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
7
|
import json
|
|
8
|
+
import os
|
|
8
9
|
import re
|
|
9
10
|
import time
|
|
10
11
|
from contextlib import contextmanager
|
|
@@ -16,11 +17,34 @@ from . import access_rules
|
|
|
16
17
|
from .login_wait import LoginWait
|
|
17
18
|
from .. import federations, progress_reporter
|
|
18
19
|
from .batch_common import (AWAY_WAIT_SEC, POLL_MS, DownloadResult, PublisherAccessBlocked, PublisherContentError, _is_browser_error,
|
|
19
|
-
_is_navigation_cut, open_page, pump_until, settle)
|
|
20
|
+
_is_navigation_cut, logger, open_page, pump_until, settle)
|
|
20
21
|
|
|
21
22
|
# A site without a publisher profile (publishers/site.py) whose article page
|
|
22
23
|
# offered no institution entry the shared rules know.
|
|
23
24
|
GENERIC_ENTRY_MISSING = "generic_institution_entry_missing"
|
|
25
|
+
# A site whose page shows no way to any school's login (no institution entry, search or
|
|
26
|
+
# list, no federation chooser), or only the publisher's own account sign-in: an open-access
|
|
27
|
+
# site, a site with personal accounts only. No school login is started there (user,
|
|
28
|
+
# 2026-11-18: an MDPI page went on to MDPI's own account login and waited for the user).
|
|
29
|
+
NO_INSTITUTION_ENTRY = "no_institution_entry"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# PaperSearch Pro's school sign-in (school_login.py): the reminder when it leaves a step to the user.
|
|
33
|
+
SIGN_IN_REFUSED = "学校没有接受保存的密码,自动登录已关闭:请在浏览器窗口完成机构登录,并在设置里更新密码"
|
|
34
|
+
SIGN_IN_SECOND_STEP = "学校还要再验证一步(如微信扫码),请在浏览器窗口完成"
|
|
35
|
+
SIGN_IN_FOR_THE_USER = "学校登录页要你本人操作(验证码、扫码或另一个账号),请在浏览器窗口完成"
|
|
36
|
+
#: A school's login page whose certificate Chrome will not take, and not the one Pro's survey saw there.
|
|
37
|
+
SIGN_IN_CERTIFICATE = "学校登录页的证书和之前记下的不一样,没有自动填写:请确认是学校的网站后,在浏览器窗口完成机构登录"
|
|
38
|
+
#: The note naming the check the school's page asks for (Pro's school sign-in tells which, 2026-11-19).
|
|
39
|
+
SIGN_IN_ASKS = {
|
|
40
|
+
"image_code": "学校登录页要输入图片验证码,请在浏览器窗口完成",
|
|
41
|
+
"slider": "学校登录页要拖动滑块拼图,请在浏览器窗口完成",
|
|
42
|
+
"click_select": "学校登录页要按顺序点选图中文字,请在浏览器窗口完成",
|
|
43
|
+
"sms_code": "学校登录页要短信或动态验证码,请在浏览器窗口完成",
|
|
44
|
+
"qr_scan": "学校登录页要扫码,请在浏览器窗口完成",
|
|
45
|
+
"site_check": "学校登录页要完成人机检查,请在浏览器窗口完成",
|
|
46
|
+
"second_factor": "学校还要二次验证,请在浏览器窗口完成",
|
|
47
|
+
}
|
|
24
48
|
|
|
25
49
|
|
|
26
50
|
class LoginMixin:
|
|
@@ -91,7 +115,11 @@ class LoginMixin:
|
|
|
91
115
|
With the institution's session, or an open-access article, the PDF is
|
|
92
116
|
taken. With nothing either way, or with only the reader's access (also
|
|
93
117
|
a personal account's or ClinicalKey's, J Hepatol 2026-10-31), the PDF is
|
|
94
|
-
tried first and the school's login follows once if it fails (batch.py).
|
|
118
|
+
tried first and the school's login follows once if it fails (batch.py).
|
|
119
|
+
|
|
120
|
+
Open to all (a badge or licence the access rule read, or the page's own
|
|
121
|
+
metadata saying so: ``_open_access_signal``): the PDF is taken with no school
|
|
122
|
+
login after it, unless its entry asks for access (batch.py)."""
|
|
95
123
|
result._open_access_current = False
|
|
96
124
|
verdict, basis, evidence = self._access_decision(page, snapshot) if snapshot is not None else self._access_decision(page)
|
|
97
125
|
if verdict != access_rules.UNKNOWN:
|
|
@@ -100,8 +128,19 @@ class LoginMixin:
|
|
|
100
128
|
self._event(result, "access_decision", detail)
|
|
101
129
|
if verdict == access_rules.OUT:
|
|
102
130
|
return False
|
|
103
|
-
open_to_all = basis == "reader" and access_rules.OPEN_TO_ALL.search(evidence.split("badge: ", 1)[-1])
|
|
131
|
+
open_to_all = (evidence if basis == "reader" and access_rules.OPEN_TO_ALL.search(evidence.split("badge: ", 1)[-1])
|
|
132
|
+
else "")
|
|
133
|
+
if not open_to_all and basis != "session":
|
|
134
|
+
# Said in the page's metadata only (an open article whose page shows no badge).
|
|
135
|
+
open_to_all = self._open_access_signal(page)
|
|
136
|
+
if open_to_all and not any(e["state"] == "open_access_signal" and e.get("detail") == open_to_all
|
|
137
|
+
for e in result.events):
|
|
138
|
+
self._event(result, "open_access_signal", open_to_all)
|
|
104
139
|
result._open_access_current = bool(open_to_all)
|
|
140
|
+
if open_to_all:
|
|
141
|
+
# Kept past navigation: batch.py's login after a gated PDF entry, and the
|
|
142
|
+
# login for a page read without its full text (_fulltext_after_login_only).
|
|
143
|
+
result._taken_as_open = open_to_all
|
|
105
144
|
if (basis != "session" and not open_to_all and not getattr(result, "_pdf_first", False)
|
|
106
145
|
and not self._school_login_done()):
|
|
107
146
|
result._pdf_first = True
|
|
@@ -282,6 +321,162 @@ class LoginMixin:
|
|
|
282
321
|
return (self.adapter.is_login_landing(url)
|
|
283
322
|
and any(e.get("state") in self._SCHOOL_CHOSEN for e in result.events))
|
|
284
323
|
|
|
324
|
+
def _school_side_steps(self, page: Any, result: DownloadResult) -> bool:
|
|
325
|
+
"""What the program does itself on the school's side of a login, wherever the login waits
|
|
326
|
+
(this general wait, or a publisher's own: Oxford's): the school's attribute release or terms
|
|
327
|
+
agreed to, its sign-in filled in by PaperSearch Pro. True when one was done and the page
|
|
328
|
+
goes on. One place, so a publisher with its own wait has them all (user, 2026-11-19: the
|
|
329
|
+
school's 信息释放 was agreed to everywhere but on Oxford's way, which waited for the user)."""
|
|
330
|
+
return (self._past_school_certificate_warning(page, result) or self._accept_idp_confirmation(page, result)
|
|
331
|
+
or self._school_sign_in(page, result))
|
|
332
|
+
|
|
333
|
+
def _past_school_certificate_warning(self, page: Any, result: DownloadResult) -> bool:
|
|
334
|
+
"""PaperSearch Pro, for a school whose login page has a certificate Chrome will not take (expired, not
|
|
335
|
+
trusted; school_login.pro_certificates): Chrome's warning for that page passed, then the page's own
|
|
336
|
+
certificate compared with the one Pro's survey saw there (user, 2026-11-20: fill those in too). Only
|
|
337
|
+
with the school's sign-in on, once a paper for each page. True when the page went on to the school's."""
|
|
338
|
+
from .. import school_login
|
|
339
|
+
|
|
340
|
+
if not str(getattr(page, "url", "") or "").startswith(school_login.WARNING_PAGES):
|
|
341
|
+
return False
|
|
342
|
+
entity_id = str(self.config.get("idp_entity_id") or "").strip()
|
|
343
|
+
account = school_login.saved(self.config, entity_id)
|
|
344
|
+
pro = school_login.module() if account and account.get("enabled") else None
|
|
345
|
+
pins = school_login.pro_certificates(pro, entity_id) if pro is not None else {}
|
|
346
|
+
passed = getattr(result, "_warnings_passed", frozenset())
|
|
347
|
+
host = school_login.warning_for(page, tuple(h for h in pins if h not in passed))
|
|
348
|
+
if not host:
|
|
349
|
+
return False
|
|
350
|
+
result._warnings_passed = passed | {host}
|
|
351
|
+
# The certificate offered, read on the warning itself: the warning passed only for the one surveyed,
|
|
352
|
+
# and the page that then loads has to have it too.
|
|
353
|
+
error, digest = school_login.page_certificate(page)
|
|
354
|
+
if school_login.warning_certificate(host, error, digest, pins):
|
|
355
|
+
if not school_login.pass_warning(page, host):
|
|
356
|
+
self._event(result, "school_certificate", f"{host}: Chrome's warning would not let the page through")
|
|
357
|
+
return False
|
|
358
|
+
error, digest = school_login.page_certificate(page)
|
|
359
|
+
if school_login.certificate_allows(host, error, digest, pins):
|
|
360
|
+
self._event(result, "school_certificate", f"{host}: {error or 'certificate'} taken, the one surveyed")
|
|
361
|
+
return True
|
|
362
|
+
# Another certificate than the survey's: nothing typed there, the warning left to the user.
|
|
363
|
+
result._sign_in_tried = True
|
|
364
|
+
result._sign_in_note = SIGN_IN_CERTIFICATE
|
|
365
|
+
self._event(result, "school_certificate", f"{host}: {error or 'unread'}, not the certificate surveyed")
|
|
366
|
+
return False
|
|
367
|
+
|
|
368
|
+
def _school_sign_in(self, page: Any, result: DownloadResult) -> bool:
|
|
369
|
+
"""PaperSearch Pro fills the school's sign-in in for the user (its tests and survey in the Pro repository):
|
|
370
|
+
on the school's own https page, for a school Pro has tested, with the account the user
|
|
371
|
+
saved, once a paper and at most school_login.PER_HOUR times an hour. True when the form
|
|
372
|
+
was sent. A wrong password turns it off for the school: the user signs in and saves the
|
|
373
|
+
account again. Never the account in an event."""
|
|
374
|
+
from .. import school_login
|
|
375
|
+
|
|
376
|
+
if os.environ.get(school_login.SURVEY_ENV) in {"1", "press"}:
|
|
377
|
+
return self._school_sign_in_survey(page, result)
|
|
378
|
+
if getattr(result, "_sign_in_tried", False):
|
|
379
|
+
return False
|
|
380
|
+
entity_id = str(self.config.get("idp_entity_id") or "").strip()
|
|
381
|
+
account = school_login.saved(self.config, entity_id)
|
|
382
|
+
pro = school_login.module() if account and account.get("enabled") else None
|
|
383
|
+
if pro is None:
|
|
384
|
+
return False # no account to fill in, turned off, or no Pro: the user signs in as before
|
|
385
|
+
|
|
386
|
+
def skipped(why: str) -> bool:
|
|
387
|
+
# Why nothing was filled in, once a paper for each reason: what a school's test reads
|
|
388
|
+
# (a school tested, 2026-11-19: the first run filled nothing and said nothing).
|
|
389
|
+
seen = getattr(result, "_sign_in_skipped", frozenset())
|
|
390
|
+
if why not in seen:
|
|
391
|
+
result._sign_in_skipped = seen | {why}
|
|
392
|
+
self._event(result, "school_sign_in_skipped", why)
|
|
393
|
+
return False
|
|
394
|
+
|
|
395
|
+
if not school_login.fills_for(entity_id, pro):
|
|
396
|
+
return skipped(f"not tested: {school_login.school_status(entity_id, pro) or 'not listed'}")
|
|
397
|
+
url = str(getattr(page, "url", "") or "")
|
|
398
|
+
also = school_login.pro_login_hosts(pro, entity_id) # its login page on another domain of its own
|
|
399
|
+
if not school_login.may_fill(url, self.config, also):
|
|
400
|
+
return skipped(f"not the school's page: {urlparse(url).scheme}://{urlparse(url).hostname or ''}")
|
|
401
|
+
kind = self._login_wait_page(page)
|
|
402
|
+
if kind != "school_login":
|
|
403
|
+
return skipped(f"not a sign-in page: {kind}")
|
|
404
|
+
if self._idp_confirmation(page):
|
|
405
|
+
return False # the school's consent or terms: agreed to by _accept_idp_confirmation, no form
|
|
406
|
+
allowed = lambda address: school_login.may_fill(address, self.config, also) # noqa: E731
|
|
407
|
+
try:
|
|
408
|
+
if not pro.ready(page, allowed, school=entity_id):
|
|
409
|
+
# A consent page, a chooser, a form already being typed in: what Pro saw.
|
|
410
|
+
describe = getattr(pro, "describe", None)
|
|
411
|
+
return skipped("no form to fill: " + (describe(page, allowed, school=entity_id) if describe else "?"))
|
|
412
|
+
except Exception as exc:
|
|
413
|
+
if not _is_browser_error(exc):
|
|
414
|
+
raise
|
|
415
|
+
return skipped(f"page unreadable: {type(exc).__name__}")
|
|
416
|
+
# Never the account to a page whose certificate Chrome will not take (the user went past the warning),
|
|
417
|
+
# but for the very certificate Pro's survey saw there (_past_school_certificate_warning).
|
|
418
|
+
pins = school_login.pro_certificates(pro, entity_id)
|
|
419
|
+
error, digest = school_login.page_certificate(page)
|
|
420
|
+
if not school_login.certificate_allows(urlparse(url).hostname or "", error, digest, pins):
|
|
421
|
+
result._sign_in_tried = True
|
|
422
|
+
if digest and pins:
|
|
423
|
+
result._sign_in_note = SIGN_IN_CERTIFICATE
|
|
424
|
+
return skipped(f"certificate not taken: {error or 'unread'}")
|
|
425
|
+
result._sign_in_tried = True
|
|
426
|
+
if not school_login.take_turn(entity_id):
|
|
427
|
+
self._event(result, "school_sign_in", f"not filled: {school_login.PER_HOUR} in the last hour")
|
|
428
|
+
return False
|
|
429
|
+
secrets = (str(account["password"]), str(account["username"]))
|
|
430
|
+
attempt = school_login.Attempt(
|
|
431
|
+
username=str(account["username"]), password=str(account["password"]), allowed=allowed,
|
|
432
|
+
event=lambda state, detail="": self._event(result, state, school_login.hide(str(detail), secrets)),
|
|
433
|
+
hidden=secrets, school=entity_id)
|
|
434
|
+
try:
|
|
435
|
+
outcome = str(pro.sign_in(page, attempt) or "failed")
|
|
436
|
+
except Exception as exc:
|
|
437
|
+
if not _is_browser_error(exc):
|
|
438
|
+
logger.warning("PaperSearch Pro's school sign-in failed: %s", type(exc).__name__)
|
|
439
|
+
outcome = "failed"
|
|
440
|
+
self._event(result, "school_sign_in", outcome if outcome in school_login.OUTCOMES else "failed")
|
|
441
|
+
if outcome == "rejected":
|
|
442
|
+
school_login.turn_off(entity_id, "rejected")
|
|
443
|
+
result._sign_in_note = SIGN_IN_REFUSED
|
|
444
|
+
elif outcome == "submitted":
|
|
445
|
+
# A step only the user can take may follow (a WeChat scan, a code: a new account, or one
|
|
446
|
+
# not used for long; user, 2026-11-19): the wait goes on, its reminder saying so.
|
|
447
|
+
result._sign_in_note = SIGN_IN_SECOND_STEP
|
|
448
|
+
elif outcome == "needs_user":
|
|
449
|
+
result._sign_in_note = SIGN_IN_ASKS.get(str(attempt.asks or ""), SIGN_IN_FOR_THE_USER)
|
|
450
|
+
return outcome == "submitted"
|
|
451
|
+
|
|
452
|
+
def _school_sign_in_survey(self, page: Any, result: DownloadResult) -> bool:
|
|
453
|
+
"""A maintainer's survey of a school's sign-in page without its account (school_login.SURVEY_ENV):
|
|
454
|
+
what Pro finds on the school's page, recorded once a paper; never the user's account. "press"
|
|
455
|
+
types a made-up one and presses for real, once, to read the school's answer."""
|
|
456
|
+
from .. import school_login
|
|
457
|
+
|
|
458
|
+
pro = school_login.module()
|
|
459
|
+
if pro is None or not hasattr(pro, "survey") or getattr(result, "_sign_in_surveyed", False):
|
|
460
|
+
return False
|
|
461
|
+
url = str(getattr(page, "url", "") or "")
|
|
462
|
+
if self._login_wait_page(page) != "school_login":
|
|
463
|
+
return False
|
|
464
|
+
result._sign_in_surveyed = result._survey_finished = True
|
|
465
|
+
also = school_login.pro_login_hosts(pro, str(self.config.get("idp_entity_id") or "").strip())
|
|
466
|
+
if not school_login.may_fill(url, self.config, also):
|
|
467
|
+
self._event(result, "school_sign_in_survey", f"not the school's page: {urlparse(url).scheme}://{urlparse(url).hostname or ''}")
|
|
468
|
+
return False
|
|
469
|
+
try:
|
|
470
|
+
said = str(pro.survey(page, lambda address: school_login.may_fill(address, self.config, also),
|
|
471
|
+
press=os.environ.get(school_login.SURVEY_ENV) == "press",
|
|
472
|
+
school=str(self.config.get("idp_entity_id") or "").strip()))
|
|
473
|
+
except Exception as exc:
|
|
474
|
+
if not _is_browser_error(exc):
|
|
475
|
+
raise
|
|
476
|
+
said = f"page unreadable: {type(exc).__name__}"
|
|
477
|
+
self._event(result, "school_sign_in_survey", said)
|
|
478
|
+
return False
|
|
479
|
+
|
|
285
480
|
def _complete_login_steps(self, page: Any, result: DownloadResult) -> bool:
|
|
286
481
|
own = self.adapter.complete_login(page, result)
|
|
287
482
|
if own is not None:
|
|
@@ -301,6 +496,8 @@ class LoginMixin:
|
|
|
301
496
|
return False
|
|
302
497
|
self._event(result, "sso_start", page.url)
|
|
303
498
|
self._dismiss_cookie_banners(page, result)
|
|
499
|
+
if self._no_entry_earlier(page, result):
|
|
500
|
+
return False
|
|
304
501
|
sites_opened = sum(e["state"] == "login_page_opened" for e in result.events)
|
|
305
502
|
entry_opened = self._click_sso_entry(page, result)
|
|
306
503
|
if not entry_opened and self.profile.generic and self._may_offer_entry(page):
|
|
@@ -328,6 +525,7 @@ class LoginMixin:
|
|
|
328
525
|
self._event(result, "login_entry_missing", looked_for)
|
|
329
526
|
self._event(result, "login_entry_controls", controls)
|
|
330
527
|
self._snapshot(page, result, "login entry missing")
|
|
528
|
+
self._remember_no_entry(page, result, GENERIC_ENTRY_MISSING)
|
|
331
529
|
return False
|
|
332
530
|
if (manual_selection and self.adapter.requires_institution_entry and not entry_opened
|
|
333
531
|
and not self._is_human_login_page(page)):
|
|
@@ -349,6 +547,8 @@ class LoginMixin:
|
|
|
349
547
|
if self._click_openathens_entry(page, result):
|
|
350
548
|
settle(page, 2_000)
|
|
351
549
|
self._select_institution(page, result)
|
|
550
|
+
if not entry_opened and self._no_school_route(page, result, sites_opened):
|
|
551
|
+
return False
|
|
352
552
|
|
|
353
553
|
deadline = self._school_login_deadline(result)
|
|
354
554
|
with self._login_wait_budget(result, "_school_login_deadline", deadline, time.time) as wait:
|
|
@@ -363,8 +563,11 @@ class LoginMixin:
|
|
|
363
563
|
away_from_publisher = False # on an IdP, federation or chooser page since the last probe
|
|
364
564
|
returned = False # back on the publisher's site after such a page: try the PDF
|
|
365
565
|
last_probe = time.time()
|
|
566
|
+
step_since = 0.0 # since when the page has been the user's step (the reminder's grace)
|
|
366
567
|
while True:
|
|
367
568
|
self._check_user_decision(result, page)
|
|
569
|
+
if self._ended_on_personal_sign_in(page, result):
|
|
570
|
+
return False
|
|
368
571
|
user_step = self._users_login_step(page)
|
|
369
572
|
wait.observe(page, user_step)
|
|
370
573
|
deadline = wait.deadline
|
|
@@ -393,11 +596,30 @@ class LoginMixin:
|
|
|
393
596
|
user_step = self._users_login_step(page)
|
|
394
597
|
wait.observe(page, user_step)
|
|
395
598
|
deadline = wait.deadline
|
|
599
|
+
if self._past_school_certificate_warning(page, result):
|
|
600
|
+
continue # the school's login page, its certificate the one surveyed: the next pass fills it
|
|
601
|
+
if user_step and self._school_sign_in(page, result):
|
|
602
|
+
# PaperSearch Pro sent the school's form: the next pass reads where it went, the school
|
|
603
|
+
# noted as visited as the passes below do, so a publisher landing elsewhere than the
|
|
604
|
+
# article afterwards has it opened again (ACS's home page, a school tested, 2026-11-19).
|
|
605
|
+
visited_idp = away_from_publisher = True
|
|
606
|
+
result._visited_idp = True
|
|
607
|
+
continue
|
|
608
|
+
if getattr(result, "_survey_finished", False):
|
|
609
|
+
# A maintainer's survey (school_login.SURVEY_ENV): the school's page recorded, on to
|
|
610
|
+
# the next school without waiting out the login (user, 2026-11-19).
|
|
611
|
+
result.reason = "survey_done"
|
|
612
|
+
return False
|
|
613
|
+
# The reminder once the user's step has stood LOGIN_PROMPT_GRACE_SEC: the school's
|
|
614
|
+
# consent page the program accepts itself, and a sign-in page the school's own
|
|
615
|
+
# session moves past by itself, go by without one (user, 2026-11-19).
|
|
616
|
+
step_since = (step_since or time.time()) if user_step else 0.0
|
|
396
617
|
message = ""
|
|
397
|
-
if user_step
|
|
618
|
+
if user_step and (time.time() - step_since >= self.LOGIN_PROMPT_GRACE_SEC
|
|
619
|
+
or getattr(result, "_login_attention", "")):
|
|
398
620
|
kind = self._login_wait_page(page)
|
|
399
621
|
message = ("请在浏览器窗口选择学校并完成机构登录" if kind in {"school_choice", "institution_chooser"}
|
|
400
|
-
else "请在浏览器窗口完成机构登录")
|
|
622
|
+
else getattr(result, "_sign_in_note", "") or "请在浏览器窗口完成机构登录")
|
|
401
623
|
self._set_login_attention(result, message, deadline, page=page)
|
|
402
624
|
marker = f"{self._title(page)} | {getattr(page, 'url', '')[:160]}"
|
|
403
625
|
here = urlparse(str(getattr(page, "url", "") or ""))
|
|
@@ -440,6 +662,10 @@ class LoginMixin:
|
|
|
440
662
|
self._event(result, "idp_return_article", here.geturl()[:160])
|
|
441
663
|
settle(page, 3_000)
|
|
442
664
|
if not self._challenge_shell(page) and not self._looks_logged_out(page):
|
|
665
|
+
# The login went round, if unseen: a session at the federation's
|
|
666
|
+
# service passed the school's own server by (PNAS via OpenAthens,
|
|
667
|
+
# 2026-11-17), and the page read before it is read again.
|
|
668
|
+
result._login_round_trip = True
|
|
443
669
|
return True
|
|
444
670
|
except Exception as exc:
|
|
445
671
|
self._event(result, "idp_return_article_error", type(exc).__name__)
|
|
@@ -588,8 +814,14 @@ class LoginMixin:
|
|
|
588
814
|
_IDP_PASSWORD_EXPIRED_RE = re.compile(r"your password has expired|密码已(?:经)?过期", re.I)
|
|
589
815
|
# The school's IdP asks the user to agree before it goes on (login state K):
|
|
590
816
|
# Shibboleth's attribute-release and terms-of-use forms, whatever the language.
|
|
817
|
+
# By their forms' fixed field names, whatever the page's language: Shibboleth's terms of use
|
|
818
|
+
# and attribute release; SimpleSAMLphp's and Apereo CAS's attribute release (schools of other
|
|
819
|
+
# sign-in software, user 2026-11-19: what a school asks after its sign-in passes by itself).
|
|
591
820
|
_IDP_CONFIRMATION_JS = """() => document.querySelector('[name="_eventId_TermsRejected"]') ? 'terms-of-use'
|
|
592
|
-
: document.querySelector('[name="_shib_idp_consentOptions"], [name="_shib_idp_consentIds"]') ? 'attribute-release'
|
|
821
|
+
: document.querySelector('[name="_shib_idp_consentOptions"], [name="_shib_idp_consentIds"]') ? 'attribute-release'
|
|
822
|
+
: document.querySelector('form input[name="StateId"]') && document.querySelector('form [name="yes"]')
|
|
823
|
+
? 'attribute-release-simplesamlphp'
|
|
824
|
+
: document.querySelector('form [name="_eventId_confirm"]') ? 'attribute-release-cas' : ''"""
|
|
593
825
|
# Shibboleth's "Message Security Error": the identity provider could not trust the
|
|
594
826
|
# publisher's request (a school's IdP to Elsevier, 2026-11-12); AD FS's "An error
|
|
595
827
|
# occurred. Contact your administrator" (two schools' AD FS, 2026-11-13).
|
|
@@ -641,14 +873,20 @@ class LoginMixin:
|
|
|
641
873
|
# (2026-11-08). The release keeps the choices the school preselected; the
|
|
642
874
|
# terms' own "I accept" box is ticked. A second factor (Duo) stays the user's,
|
|
643
875
|
# and so does a confirmation still shown after two accepts in one article.
|
|
644
|
-
IDP_ACCEPTED_CONFIRMATIONS = ("attribute-release", "terms-of-use"
|
|
876
|
+
IDP_ACCEPTED_CONFIRMATIONS = ("attribute-release", "terms-of-use", "attribute-release-simplesamlphp",
|
|
877
|
+
"attribute-release-cas")
|
|
645
878
|
IDP_CONFIRMATION_TRIES = 2
|
|
879
|
+
# Its "agree" control; SimpleSAMLphp's "remember" box ticked too, as Shibboleth's preselected
|
|
880
|
+
# "ask again only if it changes" (that publisher is not asked about again).
|
|
646
881
|
_IDP_ACCEPT_JS = r"""(kind) => {
|
|
647
882
|
const visible = el => !!el && el.getClientRects().length > 0;
|
|
648
|
-
const
|
|
883
|
+
const agree = {'attribute-release-simplesamlphp': '[name="yes"]',
|
|
884
|
+
'attribute-release-cas': '[name="_eventId_confirm"]'}[kind] || '[name="_eventId_proceed"]';
|
|
885
|
+
const proceed = [...document.querySelectorAll(agree)].find(visible);
|
|
649
886
|
if (!proceed) return false;
|
|
650
|
-
|
|
651
|
-
|
|
887
|
+
const boxes = {'terms-of-use': '_shib_idp_consentIds', 'attribute-release-simplesamlphp': 'saveconsent'}[kind];
|
|
888
|
+
if (boxes && proceed.form)
|
|
889
|
+
for (const box of proceed.form.querySelectorAll(`input[type=checkbox][name="${boxes}"]`))
|
|
652
890
|
if (!box.checked && visible(box)) box.setAttribute('data-papersearch-idp', 'tick');
|
|
653
891
|
proceed.setAttribute('data-papersearch-idp', 'proceed');
|
|
654
892
|
return true;
|
|
@@ -744,7 +982,13 @@ class LoginMixin:
|
|
|
744
982
|
if not _is_browser_error(exc):
|
|
745
983
|
raise
|
|
746
984
|
return False
|
|
747
|
-
|
|
985
|
+
queries = [q.lower() for q in self._search_queries(list(self._institution_names()))]
|
|
986
|
+
if typed.lower() not in queries:
|
|
987
|
+
return False # the user's own search
|
|
988
|
+
# A name followed by another of the school's in Latin letters, the one OpenAthens lists
|
|
989
|
+
# by, is searched by that one first ("The University of <town>" listed as "University
|
|
990
|
+
# of <town>", 2026-11-17).
|
|
991
|
+
return not any(q.isascii() for q in queries[queries.index(typed.lower()) + 1:])
|
|
748
992
|
|
|
749
993
|
# The words that made a block decision, for its record.
|
|
750
994
|
_BLOCK_WORDS = re.compile(
|
|
@@ -885,20 +1129,35 @@ class LoginMixin:
|
|
|
885
1129
|
SCHOOL_SITE_STAY_SEC = 12
|
|
886
1130
|
# A username-first page (Okta's "identifier" field, no password box yet: a
|
|
887
1131
|
# school's login was taken for its portal and ended, 2026-11-12) is a login;
|
|
888
|
-
# a portal's search box is not.
|
|
889
|
-
|
|
1132
|
+
# a portal's search box is not. A QR or code login shows its code (a square
|
|
1133
|
+
# image or canvas, or the frame that draws it) or the box for the code: a page
|
|
1134
|
+
# that only mentions them is none (a school's portal home, whose notice spoke of
|
|
1135
|
+
# signing in by scanning a code, was waited on as its login page, 2026-11-18).
|
|
1136
|
+
_SCHOOL_PAGE_STATE_JS = r"""() => {
|
|
1137
|
+
const editable = el => el.getClientRects().length > 0 && !el.disabled && !el.readOnly;
|
|
1138
|
+
const text = (document.body && document.body.innerText || '').slice(0, 4000);
|
|
1139
|
+
const qrShown = () => [...document.querySelectorAll('canvas, img, iframe')].some(el => {
|
|
1140
|
+
const box = el.getBoundingClientRect();
|
|
1141
|
+
return el.tagName === 'IFRAME' ? box.width >= 200 && box.height >= 200
|
|
1142
|
+
: box.width >= 100 && Math.abs(box.width - box.height) <= 0.1 * box.width;
|
|
1143
|
+
});
|
|
1144
|
+
const codeBox = () => [...document.querySelectorAll('input')].some(el => editable(el)
|
|
1145
|
+
&& /code|captcha|otp|验证码|校验码|动态码/i.test(`${el.name} ${el.id} ${el.placeholder || ''} ${el.autocomplete || ''}`));
|
|
1146
|
+
return {
|
|
890
1147
|
ready: document.readyState === 'complete',
|
|
891
1148
|
login: !!document.querySelector('input[type="password"], input[autocomplete="one-time-code"]')
|
|
892
|
-
|| [...document.querySelectorAll('input')].some(el => el
|
|
893
|
-
&&
|
|
1149
|
+
|| [...document.querySelectorAll('input')].some(el => editable(el) && ['text', 'email'].includes(el.type)
|
|
1150
|
+
&& (el.type === 'email'
|
|
894
1151
|
|| /username|email/i.test(el.autocomplete || '')
|
|
895
1152
|
|| /user|login|identifier|account|email|netid|学号|工号|账号|帐号/i.test(`${el.name} ${el.id}`)))
|
|
896
|
-
|| /扫码|二维码|QR ?code
|
|
1153
|
+
|| (/扫码|二维码|QR ?code/i.test(text) && qrShown())
|
|
1154
|
+
|| (/验证码|verification code/i.test(text) && codeBox())
|
|
897
1155
|
// SimpleSAMLphp's page for choosing how to sign in, one box per way (its
|
|
898
1156
|
// "multiauth" module; the buttons hidden in the boxes, 2026-11-13).
|
|
899
1157
|
|| !!document.querySelector('form [name^="sourceChoice["]'),
|
|
900
1158
|
handover: !!document.querySelector('input[name="SAMLResponse"], input[name="SAMLRequest"], input[name="RelayState"]')
|
|
901
|
-
|| /^\s*(?:loading|please wait|redirecting|正在跳转|跳转中|请稍候|处理中)/i.test(document.title || '')}
|
|
1159
|
+
|| /^\s*(?:loading|please wait|redirecting|正在跳转|跳转中|请稍候|处理中)/i.test(document.title || '')};
|
|
1160
|
+
}"""
|
|
902
1161
|
|
|
903
1162
|
def _school_domain(self, result: DownloadResult | None) -> str:
|
|
904
1163
|
"""The school's own registrable domain: its entityID's, else the IdP's this item visited."""
|
|
@@ -1323,6 +1582,273 @@ class LoginMixin:
|
|
|
1323
1582
|
f"log in / register); sign-in links (shibboleth, /wayf, ssostart, institutional-login)",
|
|
1324
1583
|
f"{str(getattr(page, 'url', '') or '')[:160]} | sign-in or access controls: {found}")
|
|
1325
1584
|
|
|
1585
|
+
# ---- a school login only through a school route (user, 2026-11-18)
|
|
1586
|
+
#
|
|
1587
|
+
# The school's login starts only from a way to it: an institution entry, sign-in link
|
|
1588
|
+
# or access menu holding one, the adapter's own entry or login page, an institution
|
|
1589
|
+
# search or list, a federation, WAYF, SeamlessAccess or OpenAthens chooser, or the
|
|
1590
|
+
# entry a publisher remembers ("Access through <school>"). A personal account sign-in
|
|
1591
|
+
# (e-mail and password, ORCID, "Register") is none. A page without any ends the login
|
|
1592
|
+
# at once (NO_INSTITUTION_ENTRY), and so do the same site's later papers in the batch.
|
|
1593
|
+
|
|
1594
|
+
# The page's signs of a way to some school's login, for every engine step that would
|
|
1595
|
+
# follow one (``_click_sso_entry``, ``_select_institution``, the wait's own steps).
|
|
1596
|
+
# Generous on purpose: a sign not followed leaves the wait as it was, a sign missed
|
|
1597
|
+
# ends the login. Controls (and links, shown or not: a hidden institution sign-in is
|
|
1598
|
+
# followed too) by their words or address; clickable text; institution search boxes
|
|
1599
|
+
# and lists; SeamlessAccess and chooser frames. Reference and related-article lists
|
|
1600
|
+
# are other works' (a title naming single sign-on is no entry).
|
|
1601
|
+
# Also whether the page holds a sign-in form (``password``, ``credential``: an e-mail
|
|
1602
|
+
# or user name field) or a sign-in with another account (``social``: ORCID, Google).
|
|
1603
|
+
_SCHOOL_ROUTE_JS = r"""(markers) => {
|
|
1604
|
+
const shown = el => { const r = el.getBoundingClientRect(), s = getComputedStyle(el);
|
|
1605
|
+
return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none'; };
|
|
1606
|
+
const WHERE = '(?:an?\\s+|your\\s+|my\\s+|the\\s+)?(?:institution|organi[sz]ation|university|library|school|campus|athens)';
|
|
1607
|
+
const WORDS = new RegExp([
|
|
1608
|
+
'\\binstitution(?:al)?\\s+(?:login|log[\\s-]?in|sign[\\s-]?in|access|users?|accounts?|credentials|subscribers?)\\b',
|
|
1609
|
+
'\\borgani[sz]ation(?:al)?\\s+(?:login|log[\\s-]?in|sign[\\s-]?in|access|accounts?)\\b',
|
|
1610
|
+
'\\b(?:librar(?:y|ies)|campus)\\s+(?:login|log[\\s-]?in|sign[\\s-]?in|access|card)\\b',
|
|
1611
|
+
'\\b(?:log|sign)[\\s-]?in\\s+(?:via|through|with|using|at|from)\\s+' + WHERE,
|
|
1612
|
+
'\\baccess\\s+(?:through|via)\\s+\\S', '\\bprovided\\s+by\\s+' + WHERE,
|
|
1613
|
+
'\\b(?:find|select|choose|search(?:\\s+for)?)\\s+(?:your|my|an?)\\s+(?:institution|organi[sz]ation)',
|
|
1614
|
+
'shibboleth', 'open\\s?athens', '\\bathens\\s+(?:login|log[\\s-]?in|sign[\\s-]?in|account)', 'seamless\\s?access',
|
|
1615
|
+
'\\bwayf\\b', 'single\\s+sign[\\s-]?on', '\\bsso\\b', '\\bsaml\\b', 'ezproxy', '\\bremote\\s+access\\b',
|
|
1616
|
+
'\\bfederated\\s+(?:login|log[\\s-]?in|sign[\\s-]?in|access|identity)',
|
|
1617
|
+
'^(?:my\\s+)?institution(?:al)?(?:\\s+(?:login|access))?$',
|
|
1618
|
+
'机构(?:登录|用户|访问|认证)', '(?:学校|校园|图书馆)(?:登录|账号|帐号|认证)', '校外访问', '统一身份认证',
|
|
1619
|
+
'通过(?:机构|学校|图书馆)'].join('|'), 'i');
|
|
1620
|
+
const PATHS = /ssostart|\/wayf|shibboleth|\/shib(?:\/|$)|openathens|\/saml|\/sso(?:\/|$)|institution(?:al)?[-_]?(?:log-?in|sign-?in|access)|\/idp(?:\/|$)|seamlessaccess/i;
|
|
1621
|
+
// An identity provider asked for by its entityID (a URL or URN), not any "entityid".
|
|
1622
|
+
const QUERY = /(?:^|[?&])(?:entityid|idp|providerid)=(?:https?(?::|%3a)|urn(?::|%3a))/i;
|
|
1623
|
+
const ELSEWHERE = '[class*="reference" i], [id*="reference" i], #references, .references, [class*="citation" i], '
|
|
1624
|
+
+ '[class*="related" i], [id*="related" i], [class*="recommend" i], [id*="recommend" i]';
|
|
1625
|
+
const CLICKABLE = 'a[href], button, [role="button"], [role="link"], [role="menuitem"], [onclick], label, summary';
|
|
1626
|
+
const extra = (markers || []).map(m => String(m || '').toLowerCase()).filter(Boolean);
|
|
1627
|
+
const text = el => (el.innerText || el.value || el.getAttribute('aria-label') || el.getAttribute('title')
|
|
1628
|
+
|| el.textContent || '').replace(/\s+/g, ' ').trim();
|
|
1629
|
+
const signs = [];
|
|
1630
|
+
const add = s => { if (signs.length < 6 && !signs.includes(s)) signs.push(s); };
|
|
1631
|
+
for (const el of document.querySelectorAll('a[href], button, [role="button"], [role="link"], [role="menuitem"], '
|
|
1632
|
+
+ 'input[type="button"], input[type="submit"], input[type="image"], [onclick]')) {
|
|
1633
|
+
if (signs.length >= 6) break;
|
|
1634
|
+
if (el.closest(ELSEWHERE) || (el.tagName !== 'A' && !shown(el))) continue;
|
|
1635
|
+
const label = text(el).slice(0, 160);
|
|
1636
|
+
let target = '', where = '', query = '';
|
|
1637
|
+
try {
|
|
1638
|
+
const raw = el.tagName === 'A' ? el.getAttribute('href') : el.getAttribute('formaction');
|
|
1639
|
+
if (raw && !/^\s*(?:javascript|mailto|tel):/i.test(raw)) {
|
|
1640
|
+
const u = new URL(raw, document.baseURI);
|
|
1641
|
+
target = u.href; where = u.hostname + u.pathname; query = u.search;
|
|
1642
|
+
}
|
|
1643
|
+
} catch (_) {}
|
|
1644
|
+
const lower = `${label} ${target}`.toLowerCase();
|
|
1645
|
+
if ((label.length <= 120 && WORDS.test(label)) || PATHS.test(where) || QUERY.test(query)
|
|
1646
|
+
|| extra.some(m => lower.includes(m)))
|
|
1647
|
+
add(`control "${label.slice(0, 60)}"${target ? ' -> ' + target.slice(0, 120) : ''}`);
|
|
1648
|
+
}
|
|
1649
|
+
const walker = document.createTreeWalker(document.body || document.documentElement, NodeFilter.SHOW_TEXT);
|
|
1650
|
+
for (let n = 0; signs.length < 6 && n < 60000 && walker.nextNode(); n++) {
|
|
1651
|
+
const t = (walker.currentNode.nodeValue || '').replace(/\s+/g, ' ').trim();
|
|
1652
|
+
if (!t || t.length > 120 || !WORDS.test(t)) continue;
|
|
1653
|
+
const el = walker.currentNode.parentElement;
|
|
1654
|
+
if (!el || !shown(el) || el.closest(ELSEWHERE)) continue;
|
|
1655
|
+
if (el.closest(CLICKABLE) || getComputedStyle(el).cursor === 'pointer'
|
|
1656
|
+
|| ((el.textContent || '').length <= 200 && el.querySelector(CLICKABLE)))
|
|
1657
|
+
add(`text "${t.slice(0, 60)}"`);
|
|
1658
|
+
}
|
|
1659
|
+
const ABOUT = /institution|organi[sz]ation|university|school|federation|\bidp\b|wayf|机构|学校|单位|联盟/i;
|
|
1660
|
+
for (const el of document.querySelectorAll('input, select')) {
|
|
1661
|
+
if (signs.length >= 6) break;
|
|
1662
|
+
if (!shown(el) || el.disabled) continue;
|
|
1663
|
+
const type = (el.getAttribute('type') || 'text').toLowerCase();
|
|
1664
|
+
if (el.tagName === 'INPUT' && !['text', 'search'].includes(type)) continue;
|
|
1665
|
+
const about = [el.getAttribute('placeholder'), el.getAttribute('name'), el.id, el.getAttribute('aria-label'),
|
|
1666
|
+
el.getAttribute('title'), el.labels && [...el.labels].map(l => l.innerText).join(' ')].join(' ');
|
|
1667
|
+
if (ABOUT.test(about)) add(`${el.tagName.toLowerCase()} "${about.replace(/\s+/g, ' ').trim().slice(0, 60)}"`);
|
|
1668
|
+
}
|
|
1669
|
+
if (document.querySelector('button.js-sa-federated-login, button.ra21-button')) add('SeamlessAccess button');
|
|
1670
|
+
for (const frame of document.querySelectorAll('iframe[src]')) {
|
|
1671
|
+
if (/seamlessaccess|wayf|openathens|shibboleth|discovery/i.test(frame.src)) add(`frame ${frame.src.slice(0, 120)}`);
|
|
1672
|
+
}
|
|
1673
|
+
const editable = el => shown(el) && !el.disabled && !el.readOnly;
|
|
1674
|
+
const inputs = [...document.querySelectorAll('input')].filter(editable);
|
|
1675
|
+
const password = inputs.some(el => el.type === 'password');
|
|
1676
|
+
const credential = password || inputs.some(el => el.type === 'email' || /username|email/i.test(el.autocomplete || '')
|
|
1677
|
+
|| (['text', ''].includes(el.type) && /e-?mail|user ?name|login|account/i.test(`${el.name} ${el.id}`)));
|
|
1678
|
+
const social = [...document.querySelectorAll('a[href], button, [role="button"]')].some(el => shown(el)
|
|
1679
|
+
&& (/orcid\.org\/(?:oauth|signin)/i.test(el.href || '')
|
|
1680
|
+
|| /^(?:(?:log|sign)\s*in|continue)\s+(?:with|via|using)\s+(?:orcid|google|apple|facebook|linkedin|microsoft|wechat|github)\b|^orcid$/i.test(text(el))));
|
|
1681
|
+
return {signs, password, credential, social, ready: document.readyState === 'complete'};
|
|
1682
|
+
}"""
|
|
1683
|
+
|
|
1684
|
+
def _route_probe(self, page: Any) -> dict | None:
|
|
1685
|
+
"""``_SCHOOL_ROUTE_JS`` on the page: ``signs`` (the ways to a school's login it
|
|
1686
|
+
shows, the adapter's own entry controls included), ``password``, ``credential``,
|
|
1687
|
+
``social``, ``ready`` (the document has loaded). None when the page could not be
|
|
1688
|
+
read: then nothing is concluded."""
|
|
1689
|
+
try:
|
|
1690
|
+
found = page.evaluate(self._SCHOOL_ROUTE_JS, [str(m).lower() for m in self.profile.sso_text_markers])
|
|
1691
|
+
except Exception as exc:
|
|
1692
|
+
if not _is_browser_error(exc):
|
|
1693
|
+
raise
|
|
1694
|
+
return None
|
|
1695
|
+
if not isinstance(found, dict) or not isinstance(found.get("signs"), list):
|
|
1696
|
+
return None
|
|
1697
|
+
probe = {"signs": [str(sign) for sign in found["signs"]],
|
|
1698
|
+
**{key: found.get(key) is True for key in ("password", "credential", "social", "ready")}}
|
|
1699
|
+
if not probe["signs"]:
|
|
1700
|
+
# The adapter's own entry controls (Playwright selectors, not the page script's).
|
|
1701
|
+
for selector in self.adapter.sso_selectors:
|
|
1702
|
+
try:
|
|
1703
|
+
if page.locator(selector).first.is_visible() is True:
|
|
1704
|
+
probe["signs"].append(f"adapter entry {selector}"[:120])
|
|
1705
|
+
break
|
|
1706
|
+
except Exception as exc:
|
|
1707
|
+
if not _is_browser_error(exc):
|
|
1708
|
+
raise
|
|
1709
|
+
return probe
|
|
1710
|
+
|
|
1711
|
+
# How long a page without any sign of a school route may take to draw one, after
|
|
1712
|
+
# the entry lookups and the school choice found nothing (access boxes built late).
|
|
1713
|
+
ROUTE_LOOK_SEC = 5
|
|
1714
|
+
|
|
1715
|
+
def _no_school_route(self, page: Any, result: DownloadResult, sites_opened: int) -> bool:
|
|
1716
|
+
"""The publisher's own page, no entry opened, nothing chosen: when it shows no sign of
|
|
1717
|
+
a school route (``_SCHOOL_ROUTE_JS``) for ``ROUTE_LOOK_SEC`` more, the login ends at
|
|
1718
|
+
once (``NO_INSTITUTION_ENTRY``) and the site is kept for the batch; True then. Not
|
|
1719
|
+
when an adapter login page was opened, the login is the one after a failed PDF (it
|
|
1720
|
+
ends such pages itself), the flow already decided (the school not listed), the page
|
|
1721
|
+
is a redirect, the institution's session shows, the publisher's own chooser is open
|
|
1722
|
+
or someone is typing, or the page cannot be read or has not finished loading (a
|
|
1723
|
+
document still loading may yet draw its entry: the wait goes on as before)."""
|
|
1724
|
+
url = str(getattr(page, "url", "") or "")
|
|
1725
|
+
if (sum(e["state"] == "login_page_opened" for e in result.events) > sites_opened
|
|
1726
|
+
or getattr(result, "_pdf_retry_login", False) or getattr(result, "_institution_not_listed", False)
|
|
1727
|
+
or any(e["state"] in self._SCHOOL_CHOSEN for e in result.events) or self._school_login_done()
|
|
1728
|
+
or self.adapter.is_redirect_page(url) or not self._may_offer_entry(page)):
|
|
1729
|
+
return False
|
|
1730
|
+
probe = self._route_probe(page)
|
|
1731
|
+
if probe is None or probe["signs"]:
|
|
1732
|
+
return False
|
|
1733
|
+
if (self._has_visible_editable_input(page) or self._institution_session(page) is not None
|
|
1734
|
+
or self.adapter.institution_chooser_open(page)):
|
|
1735
|
+
return False
|
|
1736
|
+
|
|
1737
|
+
def drawn() -> bool:
|
|
1738
|
+
again = self._route_probe(page)
|
|
1739
|
+
return again is None or bool(again["signs"]) or not self._may_offer_entry(page)
|
|
1740
|
+
|
|
1741
|
+
if pump_until(page, drawn, self.ROUTE_LOOK_SEC * 1000, step_ms=1_000):
|
|
1742
|
+
return False
|
|
1743
|
+
last = self._route_probe(page)
|
|
1744
|
+
if last is None or last["signs"] or not last["ready"]:
|
|
1745
|
+
return False
|
|
1746
|
+
result.reason = NO_INSTITUTION_ENTRY
|
|
1747
|
+
looked_for, controls = self._entry_lookup_evidence(page)
|
|
1748
|
+
self._event(result, NO_INSTITUTION_ENTRY,
|
|
1749
|
+
f"{url[:160]} | no institution entry, sign-in link, institution search or list, or chooser "
|
|
1750
|
+
f"after {self.ROUTE_LOOK_SEC} s more; {looked_for}")
|
|
1751
|
+
self._event(result, "login_entry_controls", controls)
|
|
1752
|
+
self._snapshot(page, result, "no school login entry")
|
|
1753
|
+
self._remember_no_entry(page, result, NO_INSTITUTION_ENTRY)
|
|
1754
|
+
return True
|
|
1755
|
+
|
|
1756
|
+
# The publisher's own account sign-in, with no school entry on it, is never the school's
|
|
1757
|
+
# login: the wait ends once it has stood this long (time for an institutional option
|
|
1758
|
+
# drawn late by script to show).
|
|
1759
|
+
PERSONAL_SIGN_IN_SEC = 5
|
|
1760
|
+
|
|
1761
|
+
# How long a page must stay the user's step (a school's sign-in, a choice of school) before
|
|
1762
|
+
# the window asks the user: a consent page is accepted, a kept sign-in goes on, within it.
|
|
1763
|
+
LOGIN_PROMPT_GRACE_SEC = 5
|
|
1764
|
+
|
|
1765
|
+
def _personal_sign_in_only(self, page: Any, result: DownloadResult | None) -> str:
|
|
1766
|
+
"""The publisher's own account sign-in and nothing for a school (evidence, else ""): on
|
|
1767
|
+
the publisher's site (its account host too, auth.<publisher>), before this paper chose
|
|
1768
|
+
a school or reached the school's side; a password field, or on a sign-in address an
|
|
1769
|
+
e-mail or user name field or an ORCID-style sign-in; no sign of a school route; nobody
|
|
1770
|
+
typing. A form the user fills stays theirs."""
|
|
1771
|
+
url = str(getattr(page, "url", "") or "")
|
|
1772
|
+
parsed = urlparse(url)
|
|
1773
|
+
if (parsed.scheme not in ("http", "https") or not self._on_publisher_host(url)
|
|
1774
|
+
or self._is_idp_host(parsed.netloc) or self._on_school_login_page(url)
|
|
1775
|
+
or self._is_federation_chooser(url) or self._school_login_done()
|
|
1776
|
+
or (result is not None and any(e.get("state") in self._SCHOOL_CHOSEN for e in result.events))):
|
|
1777
|
+
return ""
|
|
1778
|
+
auth = self._is_auth_page(url)
|
|
1779
|
+
if not auth:
|
|
1780
|
+
try:
|
|
1781
|
+
boxes = page.locator(self._CREDENTIAL_BOX).count()
|
|
1782
|
+
except Exception as exc:
|
|
1783
|
+
if not _is_browser_error(exc):
|
|
1784
|
+
raise
|
|
1785
|
+
return ""
|
|
1786
|
+
if not (isinstance(boxes, int) and boxes > 0):
|
|
1787
|
+
return ""
|
|
1788
|
+
probe = self._route_probe(page)
|
|
1789
|
+
if probe is None or probe["signs"]:
|
|
1790
|
+
return ""
|
|
1791
|
+
if not (probe["password"] or (auth and (probe["credential"] or probe["social"]))):
|
|
1792
|
+
return ""
|
|
1793
|
+
if self._has_visible_editable_input(page):
|
|
1794
|
+
return ""
|
|
1795
|
+
what = ", ".join(key for key in ("password", "credential", "social") if probe[key])
|
|
1796
|
+
return f"{url[:200]} | the publisher's own account sign-in ({what}); no school login entry on it"
|
|
1797
|
+
|
|
1798
|
+
def _ended_on_personal_sign_in(self, page: Any, result: DownloadResult) -> bool:
|
|
1799
|
+
"""One pass of the login wait: the page has been the publisher's own account sign-in
|
|
1800
|
+
(``_personal_sign_in_only``) for ``PERSONAL_SIGN_IN_SEC``: the login ends at once
|
|
1801
|
+
(``NO_INSTITUTION_ENTRY``); until then it is not the user's step."""
|
|
1802
|
+
personal = self._personal_sign_in_only(page, result)
|
|
1803
|
+
if not personal:
|
|
1804
|
+
result._personal_page = None
|
|
1805
|
+
return False
|
|
1806
|
+
url = str(getattr(page, "url", "") or "")
|
|
1807
|
+
held = getattr(result, "_personal_page", None)
|
|
1808
|
+
if not held or held[0] != url:
|
|
1809
|
+
result._personal_page = (url, time.time())
|
|
1810
|
+
return False
|
|
1811
|
+
if time.time() - held[1] < self.PERSONAL_SIGN_IN_SEC:
|
|
1812
|
+
return False
|
|
1813
|
+
result.reason = NO_INSTITUTION_ENTRY
|
|
1814
|
+
self._event(result, NO_INSTITUTION_ENTRY, personal)
|
|
1815
|
+
self._snapshot(page, result, "personal account sign-in only")
|
|
1816
|
+
return True
|
|
1817
|
+
|
|
1818
|
+
def _no_entry_earlier(self, page: Any, result: DownloadResult) -> bool:
|
|
1819
|
+
"""An earlier paper of this batch found no school login entry on this site's page
|
|
1820
|
+
(``login_routes.no_entry_since``) and this page shows none either: ended at once,
|
|
1821
|
+
nothing looked for or clicked, with that paper's reason. The login after a failed PDF
|
|
1822
|
+
ends as the first paper's did, the PDF's reason kept."""
|
|
1823
|
+
from .. import login_routes, progress_reporter
|
|
1824
|
+
|
|
1825
|
+
host = (urlparse(str(getattr(page, "url", "") or "")).hostname or "").lower()
|
|
1826
|
+
batch = progress_reporter.batch_id()
|
|
1827
|
+
earlier = login_routes.no_entry_since(host, batch) if host and batch else {}
|
|
1828
|
+
if not earlier or not self._may_offer_entry(page):
|
|
1829
|
+
return False
|
|
1830
|
+
probe = self._route_probe(page)
|
|
1831
|
+
if probe is None or probe["signs"]:
|
|
1832
|
+
return False
|
|
1833
|
+
reason = earlier["reason"] if earlier["reason"] in (NO_INSTITUTION_ENTRY, GENERIC_ENTRY_MISSING) \
|
|
1834
|
+
else NO_INSTITUTION_ENTRY
|
|
1835
|
+
self._event(result, NO_INSTITUTION_ENTRY,
|
|
1836
|
+
f"{host}: no school login entry on an earlier paper of this batch ({earlier['doi']}), "
|
|
1837
|
+
f"none on this page either")
|
|
1838
|
+
if not getattr(result, "_pdf_retry_login", False):
|
|
1839
|
+
result.reason = reason
|
|
1840
|
+
return True
|
|
1841
|
+
|
|
1842
|
+
def _remember_no_entry(self, page: Any, result: DownloadResult, reason: str) -> None:
|
|
1843
|
+
"""Keep the page's site as showing no school login entry for this batch
|
|
1844
|
+
(``login_routes.remember_no_entry``); nothing for a download on its own."""
|
|
1845
|
+
from .. import login_routes, progress_reporter
|
|
1846
|
+
|
|
1847
|
+
host = (urlparse(str(getattr(page, "url", "") or "")).hostname or "").lower()
|
|
1848
|
+
batch = progress_reporter.batch_id()
|
|
1849
|
+
if host and batch and login_routes.remember_no_entry(host, batch, result.doi, reason):
|
|
1850
|
+
self._event(result, "no_institution_entry_remembered", f"{host}, for the rest of this batch")
|
|
1851
|
+
|
|
1326
1852
|
def _manual_institution_target_allowed(self, href: str) -> bool:
|
|
1327
1853
|
target = urlparse(href)
|
|
1328
1854
|
if (target.scheme != "https" or target.username or target.password
|
|
@@ -1438,8 +1964,12 @@ class LoginMixin:
|
|
|
1438
1964
|
return now - outside_since >= self.page_wait_sec, outside_since
|
|
1439
1965
|
|
|
1440
1966
|
def _users_login_step(self, page: Any) -> bool:
|
|
1441
|
-
"""Require a current credential/consent control, not just an IdP URL.
|
|
1967
|
+
"""Require a current credential/consent control, not just an IdP URL. Never the
|
|
1968
|
+
publisher's own account sign-in (``_ended_on_personal_sign_in``)."""
|
|
1442
1969
|
url = str(getattr(page, "url", "") or "")
|
|
1970
|
+
held = getattr(getattr(self, "_item_result", None), "_personal_page", None)
|
|
1971
|
+
if held and held[0] == url:
|
|
1972
|
+
return False
|
|
1443
1973
|
if self._is_human_login_page(page):
|
|
1444
1974
|
return True
|
|
1445
1975
|
return (not self._is_idp_host(urlparse(url).netloc) and self._is_auth_page(url)
|
|
@@ -1538,13 +2068,16 @@ class LoginMixin:
|
|
|
1538
2068
|
"""A publisher account form can be on an article, login page or SSO host.
|
|
1539
2069
|
|
|
1540
2070
|
An untouched form next to a separate institutional entry is not the
|
|
1541
|
-
school's credentials step
|
|
1542
|
-
|
|
2071
|
+
school's credentials step, nor one on the publisher's own sign-in page
|
|
2072
|
+
with no school login entry at all (``_personal_sign_in_only``). Preserve a
|
|
2073
|
+
known IdP and any form the user is already filling; return only field
|
|
2074
|
+
presence/activity, never values.
|
|
1543
2075
|
"""
|
|
1544
2076
|
if self._is_idp_host(urlparse(url).netloc) or self._has_visible_editable_input(page):
|
|
1545
2077
|
return False
|
|
1546
2078
|
return ((self._on_publisher_host(url) and self._is_success_article_url(url) and not self._is_auth_page(url))
|
|
1547
|
-
or isinstance(page.evaluate(self._INSTITUTION_ENTRY_JS), dict)
|
|
2079
|
+
or isinstance(page.evaluate(self._INSTITUTION_ENTRY_JS), dict)
|
|
2080
|
+
or bool(self._personal_sign_in_only(page, getattr(self, "_item_result", None))))
|
|
1548
2081
|
|
|
1549
2082
|
def _follow_federated_login_option(self, page: Any, result: DownloadResult) -> bool:
|
|
1550
2083
|
"""The publisher's login page offers an institutional option next to the
|