papersearch 0.7.3 → 0.8.1
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/NOTICE +8 -37
- package/README.fr.md +265 -0
- package/README.ja.md +265 -0
- package/README.ko.md +265 -0
- package/README.md +149 -148
- package/README.zh-Hant.md +265 -0
- package/README.zh.md +265 -0
- package/dist/capabilities/download/batch/batch.d.ts +20 -1
- package/dist/capabilities/download/batch/batch.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batch.js +1057 -208
- package/dist/capabilities/download/batch/batch.js.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.js +3 -2
- package/dist/capabilities/download/batch/batchFolder.js.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.d.ts +11 -2
- package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.js +24 -3
- package/dist/capabilities/download/batch/networkLoss.js.map +1 -1
- package/dist/capabilities/download/batch/resume.d.ts +7 -0
- package/dist/capabilities/download/batch/resume.d.ts.map +1 -1
- package/dist/capabilities/download/batch/resume.js +50 -9
- package/dist/capabilities/download/batch/resume.js.map +1 -1
- package/dist/capabilities/download/batch/windowPlan.d.ts +96 -0
- package/dist/capabilities/download/batch/windowPlan.d.ts.map +1 -0
- package/dist/capabilities/download/batch/windowPlan.js +196 -0
- package/dist/capabilities/download/batch/windowPlan.js.map +1 -0
- package/dist/capabilities/download/content/markdown/pro.d.ts +6 -0
- package/dist/capabilities/download/content/markdown/pro.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/pro.js.map +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.d.ts +8 -5
- package/dist/capabilities/download/content/markdown/shortfall.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.js +22 -10
- package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -1
- package/dist/capabilities/download/content/markdown/step.d.ts +9 -0
- package/dist/capabilities/download/content/markdown/step.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/step.js +46 -3
- package/dist/capabilities/download/content/markdown/step.js.map +1 -1
- package/dist/capabilities/download/content/markdown/types.d.ts +10 -1
- package/dist/capabilities/download/content/markdown/types.d.ts.map +1 -1
- package/dist/capabilities/download/content/pdf/open/tiers/scihub.d.ts.map +1 -1
- package/dist/capabilities/download/content/pdf/open/tiers/scihub.js +3 -1
- package/dist/capabilities/download/content/pdf/open/tiers/scihub.js.map +1 -1
- package/dist/capabilities/download/handler.d.ts.map +1 -1
- package/dist/capabilities/download/handler.js +13 -5
- package/dist/capabilities/download/handler.js.map +1 -1
- package/dist/capabilities/download/outputLayout.d.ts.map +1 -1
- package/dist/capabilities/download/outputLayout.js +3 -1
- package/dist/capabilities/download/outputLayout.js.map +1 -1
- package/dist/capabilities/download/tools.js +2 -2
- package/dist/capabilities/download/tools.js.map +1 -1
- package/dist/capabilities/download/types.d.ts +9 -1
- package/dist/capabilities/download/types.d.ts.map +1 -1
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/http/hostGate.d.ts +24 -0
- package/dist/infrastructure/http/hostGate.d.ts.map +1 -0
- package/dist/infrastructure/http/hostGate.js +72 -0
- package/dist/infrastructure/http/hostGate.js.map +1 -0
- package/dist/infrastructure/pdf/PdfDownload.d.ts +1 -0
- package/dist/infrastructure/pdf/PdfDownload.d.ts.map +1 -1
- package/dist/infrastructure/pdf/PdfDownload.js +6 -1
- package/dist/infrastructure/pdf/PdfDownload.js.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.d.ts +14 -0
- package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.js +30 -4
- package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts +2 -1
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +27 -4
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.d.ts +11 -0
- package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.js +48 -5
- package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.d.ts +13 -2
- package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.js +138 -15
- package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -1
- package/dist/infrastructure/school/SchoolProgress.d.ts +2 -0
- package/dist/infrastructure/school/SchoolProgress.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolProgress.js +2 -0
- package/dist/infrastructure/school/SchoolProgress.js.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.d.ts +9 -0
- package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.js +10 -0
- package/dist/infrastructure/school/SchoolReadiness.js.map +1 -1
- package/dist/infrastructure/school/SchoolResultNormalizer.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolResultNormalizer.js +4 -0
- package/dist/infrastructure/school/SchoolResultNormalizer.js.map +1 -1
- package/dist/infrastructure/school/index.d.ts +2 -2
- package/dist/infrastructure/school/index.d.ts.map +1 -1
- package/dist/infrastructure/school/index.js +1 -1
- package/dist/infrastructure/school/index.js.map +1 -1
- package/dist/infrastructure/school/types.d.ts +73 -1
- package/dist/infrastructure/school/types.d.ts.map +1 -1
- package/dist/infrastructure/school/types.js.map +1 -1
- package/dist/infrastructure/security/SecurityUtils.d.ts.map +1 -1
- package/dist/infrastructure/security/SecurityUtils.js +6 -2
- package/dist/infrastructure/security/SecurityUtils.js.map +1 -1
- package/dist/management/failures/index.d.ts +23 -0
- package/dist/management/failures/index.d.ts.map +1 -1
- package/dist/management/failures/index.js +68 -20
- package/dist/management/failures/index.js.map +1 -1
- package/dist/management/school/autoUpdate.d.ts.map +1 -1
- package/dist/management/school/autoUpdate.js +9 -1
- package/dist/management/school/autoUpdate.js.map +1 -1
- package/dist/management/school/cliProgress.d.ts.map +1 -1
- package/dist/management/school/cliProgress.js +3 -1
- package/dist/management/school/cliProgress.js.map +1 -1
- package/package.json +8 -3
- package/school/NOTICE +3 -2
- package/school/paper_search_school/adapters/__init__.py +2 -0
- package/school/paper_search_school/adapters/aps/__init__.py +3 -6
- package/school/paper_search_school/adapters/base.py +19 -2
- package/school/paper_search_school/adapters/copernicus/__init__.py +2 -7
- package/school/paper_search_school/adapters/elsevier/__init__.py +50 -1
- package/school/paper_search_school/adapters/frontiers/__init__.py +41 -2
- package/school/paper_search_school/adapters/ieee/__init__.py +6 -4
- package/school/paper_search_school/adapters/iop/__init__.py +8 -0
- package/school/paper_search_school/adapters/jama/__init__.py +8 -0
- package/school/paper_search_school/adapters/lww/__init__.py +14 -6
- package/school/paper_search_school/adapters/mdpi/__init__.py +12 -7
- package/school/paper_search_school/adapters/neurology/__init__.py +5 -2
- package/school/paper_search_school/adapters/optica/__init__.py +52 -13
- package/school/paper_search_school/adapters/oup/__init__.py +7 -4
- package/school/paper_search_school/adapters/platforms/__init__.py +4 -1
- package/school/paper_search_school/adapters/platforms/atypon/__init__.py +12 -3
- package/school/paper_search_school/adapters/platforms/figshare/__init__.py +23 -4
- package/school/paper_search_school/adapters/platforms/jstage/__init__.py +64 -0
- package/school/paper_search_school/adapters/taylor_francis/__init__.py +0 -3
- package/school/paper_search_school/adapters/thieme/__init__.py +2 -9
- package/school/paper_search_school/api_keys.py +63 -13
- package/school/paper_search_school/assets/api_keys.json +14 -0
- package/school/paper_search_school/assets/capsule.html +526 -147
- package/school/paper_search_school/assets/capsule_en.json +140 -49
- package/school/paper_search_school/assets/capsule_fr.json +141 -50
- package/school/paper_search_school/assets/capsule_ja.json +140 -49
- package/school/paper_search_school/assets/capsule_ko.json +140 -49
- package/school/paper_search_school/assets/capsule_zh-Hant.json +134 -48
- package/school/paper_search_school/browser/backend.py +125 -4
- package/school/paper_search_school/browser/batch_session.py +189 -8
- package/school/paper_search_school/browser/challenge/__init__.py +12 -9
- package/school/paper_search_school/browser/challenge/continuation.py +83 -0
- package/school/paper_search_school/browser/challenge/handlers/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/handlers/aws_waf.py +260 -0
- package/school/paper_search_school/browser/challenge/handlers/recaptcha_hcaptcha.py +167 -0
- package/school/paper_search_school/browser/challenge/handlers/text_captcha.py +128 -0
- package/school/paper_search_school/browser/challenge/handlers/turnstile.py +174 -0
- package/school/paper_search_school/browser/challenge/kinds.py +203 -0
- package/school/paper_search_school/browser/challenge/local/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/{interaction.py → local/interaction.py} +94 -13
- package/school/paper_search_school/browser/challenge/{pointer.py → local/pointer.py} +2 -2
- package/school/paper_search_school/browser/challenge/local/prompt.py +283 -0
- package/school/paper_search_school/browser/challenge/local/submission.py +33 -0
- package/school/paper_search_school/browser/challenge/pro.py +24 -0
- package/school/paper_search_school/browser/challenge/services/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/services/solver.py +292 -0
- package/school/paper_search_school/browser/engine.py +4 -1
- package/school/paper_search_school/browser/user_turn.py +126 -0
- package/school/paper_search_school/browser/watchdog.py +213 -60
- package/school/paper_search_school/cli_config.py +10 -5
- package/school/paper_search_school/config.py +16 -10
- package/school/paper_search_school/download_diagnostics.py +7 -2
- package/school/paper_search_school/engine/access_rules.py +12 -3
- package/school/paper_search_school/engine/batch.py +52 -18
- package/school/paper_search_school/engine/batch_access.py +62 -16
- package/school/paper_search_school/engine/batch_capture.py +260 -31
- package/school/paper_search_school/engine/batch_common.py +3 -0
- package/school/paper_search_school/engine/batch_diagnostics.py +25 -5
- package/school/paper_search_school/engine/batch_institution.py +52 -3
- package/school/paper_search_school/engine/batch_login.py +398 -36
- package/school/paper_search_school/engine/batch_pdf_urls.py +38 -7
- package/school/paper_search_school/engine/batch_user.py +48 -3
- package/school/paper_search_school/engine/batch_waits.py +221 -14
- package/school/paper_search_school/engine/bridge.py +29 -6
- package/school/paper_search_school/engine/fulltext_page.py +55 -8
- package/school/paper_search_school/engine/router.py +16 -1
- package/school/paper_search_school/engine/supplements.py +7 -1
- package/school/paper_search_school/entitlements.py +29 -1
- package/school/paper_search_school/pdf_utils.py +25 -16
- package/school/paper_search_school/progress_capsule.py +69 -11
- package/school/paper_search_school/progress_reporter.py +243 -11
- package/school/paper_search_school/progress_view.py +205 -91
- package/school/paper_search_school/publishers/builtin/iop.json +2 -1
- package/school/paper_search_school/publishers/builtin/neurology.json +4 -2
- package/school/paper_search_school/publishers/site.py +12 -4
- package/school/paper_search_school/rate_limit.py +24 -1
- package/school/paper_search_school/school_login.py +170 -8
- package/school/paper_search_school/school_test.py +1 -1
- package/school/paper_search_school/server.py +179 -23
- package/school/paper_search_school/user_settings.py +46 -4
- package/school/pyproject.toml +1 -0
- package/skills/paper-search/SKILL.md +107 -107
- package/skills/paper-search/references/browser-download.md +102 -99
- package/skills/paper-search/references/capability-routing.md +89 -89
- package/skills/paper-search/references/cli-contract.md +78 -78
- package/skills/paper-search/references/federation-support.md +172 -172
- package/skills/paper-search/references/management-layer.md +78 -78
- package/skills/paper-search/references/publisher-support.md +38 -38
- package/skills/paper-search/references/school-setup.md +56 -55
- package/skills/paper-search/references/setup.md +20 -20
- package/skills/paper-search/references/troubleshooting.md +12 -12
- package/README.en.md +0 -264
- package/school/paper_search_school/browser/challenge/prompt.py +0 -154
|
@@ -94,6 +94,15 @@ from .batch_user import PdfFoundWhileWaiting, UserProvidedPdf, UserRequestsMixin
|
|
|
94
94
|
from ..browser import watchdog
|
|
95
95
|
from ..entitlements import UserSkippedArticle, UserStoppedBatch
|
|
96
96
|
|
|
97
|
+
# Why a school login that ended without the article ended, set by the login itself: kept as the
|
|
98
|
+
# article's reason, not "PDF not captured". DBpia's institution search had no entry for the school
|
|
99
|
+
# (institution_federation_unavailable, its wait ended so), and the article was reported as 原因不明 ·
|
|
100
|
+
# 没取到 PDF (Windows 2026-11-24).
|
|
101
|
+
_LOGIN_ENDINGS = frozenset({GENERIC_ENTRY_MISSING, NO_INSTITUTION_ENTRY, "institution_federation_unavailable",
|
|
102
|
+
"publisher_institution_entry_missing", "idp_no_return_to_publisher"})
|
|
103
|
+
# An article open to all that its site gives as a web page only (``_page_offers_no_pdf``).
|
|
104
|
+
PDF_NOT_OFFERED = "pdf_not_offered"
|
|
105
|
+
|
|
97
106
|
|
|
98
107
|
class PublisherBatchDownloader(
|
|
99
108
|
LoginMixin,
|
|
@@ -215,12 +224,13 @@ class PublisherBatchDownloader(
|
|
|
215
224
|
own_page = [final_url] if final_url and self.adapter.is_article_page_url(final_url) else []
|
|
216
225
|
candidates = self.adapter.supplements_page_urls(doi) or [self._article_url(doi)]
|
|
217
226
|
incomplete = ""
|
|
218
|
-
listed =
|
|
219
|
-
if listed:
|
|
220
|
-
# Read on the article page before its PDF: no second load
|
|
221
|
-
|
|
227
|
+
listed = getattr(result, "_listed_supplements", None)
|
|
228
|
+
if listed is not None:
|
|
229
|
+
# Read on the article page before its PDF: no second load (none when it
|
|
230
|
+
# listed none: Optica's articles without any, 8 to 27 s each, 2026-11-26).
|
|
231
|
+
links = list(listed)
|
|
222
232
|
self._event(result, "supplements_listed_on_article", str(len(links)))
|
|
223
|
-
for url in ([] if listed else dict.fromkeys(own_page + candidates)):
|
|
233
|
+
for url in ([] if listed is not None else dict.fromkeys(own_page + candidates)):
|
|
224
234
|
open_page(page, url, timeout_ms=60_000)
|
|
225
235
|
if self._challenge_shell(page) or self._is_challenge_page(page):
|
|
226
236
|
if not self._wait_for_challenge(page, result):
|
|
@@ -258,8 +268,9 @@ class PublisherBatchDownloader(
|
|
|
258
268
|
return [{"status": "failed", "reason": incomplete, "url": "", "label": ""}]
|
|
259
269
|
self._event(result, "supplements_found", str(len(links)))
|
|
260
270
|
progress_reporter.update(supplements_total=len(links))
|
|
261
|
-
if self.config.get("fulltext"):
|
|
262
|
-
# --fulltext on a visit for the attachments alone: the article page it opened
|
|
271
|
+
if self.config.get("fulltext") and listed is None:
|
|
272
|
+
# --fulltext on a visit for the attachments alone: the article page it opened (none
|
|
273
|
+
# was when the files were read before the PDF: a blank tab is no page to read).
|
|
263
274
|
self._remember_fulltext_page(page, doi, result)
|
|
264
275
|
files = []
|
|
265
276
|
if links:
|
|
@@ -388,6 +399,8 @@ class PublisherBatchDownloader(
|
|
|
388
399
|
require_interactive_browser: bool = False,
|
|
389
400
|
) -> None:
|
|
390
401
|
self.config = load_config() if config is None else config
|
|
402
|
+
from ..browser.challenge.services.solver import Budget
|
|
403
|
+
self._captcha_budget = Budget(config=self.config)
|
|
391
404
|
self.profile = profile
|
|
392
405
|
self.institution_query = institution_query.strip()
|
|
393
406
|
self.login_timeout_sec = login_timeout_sec
|
|
@@ -447,7 +460,7 @@ class PublisherBatchDownloader(
|
|
|
447
460
|
config["browser_headless"] = False
|
|
448
461
|
started = time.time()
|
|
449
462
|
ctx = get_persistent_context(profile_path, config)
|
|
450
|
-
from ..browser.challenge.interaction import prepare_context
|
|
463
|
+
from ..browser.challenge.local.interaction import prepare_context
|
|
451
464
|
prepare_context(ctx)
|
|
452
465
|
self._browser_start = {**dict(getattr(browser_backend, "LAST_LAUNCH", {}) or {}),
|
|
453
466
|
"seconds": round(time.time() - started, 1), **({"relaunch": relaunch} if relaunch else {})}
|
|
@@ -488,6 +501,7 @@ class PublisherBatchDownloader(
|
|
|
488
501
|
self._record_title = record.title
|
|
489
502
|
self._expected_title = ""
|
|
490
503
|
self._manual_school = False
|
|
504
|
+
self._article_host = "" # the site the article opens on (_note_article_host)
|
|
491
505
|
self._track_article_for_adapter(page, record.doi)
|
|
492
506
|
from ..browser import watchdog
|
|
493
507
|
|
|
@@ -555,16 +569,24 @@ class PublisherBatchDownloader(
|
|
|
555
569
|
# reader's access showed): the school's login, once, then the PDF again.
|
|
556
570
|
# So too for a page taken as open to all whose PDF entry asked for access
|
|
557
571
|
# (PNAS 2026-11-17: a Creative Commons line in the copyright notes, "GET
|
|
558
|
-
# ACCESS" by the title, the PDF addresses 403 until the school's login)
|
|
559
|
-
|
|
560
|
-
|
|
572
|
+
# ACCESS" by the title, the PDF addresses 403 until the school's login), and
|
|
573
|
+
# for one whose PDF was sent to the article's web page: open for its web page
|
|
574
|
+
# only, or not at all (JAMA's citation_fulltext_world_readable, 10.1001/jama.2025.19316;
|
|
575
|
+
# jacc.org's "This is an Open Access Article" by "GET ACCESS", 10.1016/j.jcmg.2025.09.021;
|
|
576
|
+
# both ended as pdf_not_captured, no school tried, Windows 2026-11-23).
|
|
577
|
+
taken_as_open = getattr(result, "_taken_as_open", False)
|
|
578
|
+
sent_back = self._pdf_sent_to_article(page, result, attempts_from) if taken_as_open else []
|
|
579
|
+
gated = bool(taken_as_open and (sent_back or any(e["state"] == "pdf_entry_gated" for e in result.events)))
|
|
561
580
|
retry = (not wall and (getattr(result, "_pdf_first", False) or gated) and not self._school_login_done())
|
|
562
581
|
if wall or retry:
|
|
563
582
|
if wall:
|
|
564
583
|
self._event(result, "auth_wall_after_pdf_attempt", self._decision_text(page))
|
|
565
584
|
else:
|
|
585
|
+
url = str(getattr(page, "url", "") or "")
|
|
566
586
|
self._event(result, "open_access_pdf_gated" if gated and not getattr(result, "_pdf_first", False)
|
|
567
|
-
else "access_unknown_pdf_failed",
|
|
587
|
+
else "access_unknown_pdf_failed",
|
|
588
|
+
f"{url[:160]} | PDF sent to the article's web page: {str(sent_back[-1].get('url'))[:120]}"
|
|
589
|
+
if sent_back else url)
|
|
568
590
|
self._reopen_article_page(page, result)
|
|
569
591
|
result._pdf_retry_login = True
|
|
570
592
|
logged_in = self._complete_login_from_current_page(page, result)
|
|
@@ -622,10 +644,14 @@ class PublisherBatchDownloader(
|
|
|
622
644
|
self._write_diagnostic(page, result, run_dir)
|
|
623
645
|
return result
|
|
624
646
|
if not pdf_bytes:
|
|
625
|
-
#
|
|
626
|
-
#
|
|
627
|
-
|
|
628
|
-
|
|
647
|
+
# The login's own ending says why (_LOGIN_ENDINGS): a site whose page offered no
|
|
648
|
+
# institution entry, a school the publisher's list lacks. A wait on the user that ran
|
|
649
|
+
# out says where it ended, as for a login that did not complete (_login_failed: the
|
|
650
|
+
# bridge's login_timeout or login_not_reached): DBpia's institution search found
|
|
651
|
+
# nothing for a school, the wait stood a minute on it, then 没取到 PDF (2026-11-24).
|
|
652
|
+
result.reason = result.state = (
|
|
653
|
+
result.reason if result.reason in _LOGIN_ENDINGS
|
|
654
|
+
else "sso_required" if getattr(result, "login_wait_page", "") else "pdf_not_captured")
|
|
629
655
|
result.final_url = page.url
|
|
630
656
|
result.title = self._title(page)
|
|
631
657
|
self._write_diagnostic(page, result, run_dir)
|
|
@@ -638,9 +664,17 @@ class PublisherBatchDownloader(
|
|
|
638
664
|
self._write_diagnostic(page, result, run_dir)
|
|
639
665
|
return result
|
|
640
666
|
block_reason = self._login_block_reason(page)
|
|
641
|
-
|
|
667
|
+
# The capture came after this item's school login, or none came in this item:
|
|
668
|
+
# then the school's session on the page, from an earlier item, is what counts.
|
|
669
|
+
if (not block_reason and (signed_in or not self._school_login_done())
|
|
642
670
|
and self._pdf_sent_to_article_after_login(page, result, attempts_from)):
|
|
643
671
|
block_reason = "institution_pdf_entitlement_missing"
|
|
672
|
+
if (not block_reason and taken_as_open and len(result.pdf_attempts) == attempts_from
|
|
673
|
+
and self._page_offers_no_pdf(page)):
|
|
674
|
+
# Open to all, nothing tried, and nothing on the page names a PDF.
|
|
675
|
+
block_reason = PDF_NOT_OFFERED
|
|
676
|
+
self._event(result, PDF_NOT_OFFERED, f"{str(getattr(page, 'url', '') or '')[:160]} | "
|
|
677
|
+
f"{self._title(page)[:80]} | nothing on the page names a PDF")
|
|
644
678
|
result.reason = block_reason or "pdf_not_captured"
|
|
645
679
|
result.state = result.reason
|
|
646
680
|
result.final_url = page.url
|
|
@@ -695,7 +729,7 @@ class PublisherBatchDownloader(
|
|
|
695
729
|
except PublisherPlatformUnsupported as platform:
|
|
696
730
|
result.reason = result.state = "unsupported_platform"
|
|
697
731
|
self._event(result, "unsupported_platform", str(platform))
|
|
698
|
-
progress_reporter.update(phase=f"这篇文章只在 {platform}
|
|
732
|
+
progress_reporter.update(phase=f"这篇文章只在 {platform} 平台提供,PaperSearch 还没有这个平台的规则,当前路径已停止")
|
|
699
733
|
self._write_diagnostic(page, result, run_dir)
|
|
700
734
|
return result
|
|
701
735
|
except PublisherContentError as error:
|
|
@@ -27,7 +27,23 @@ from .batch_common import (
|
|
|
27
27
|
# not answer: Envoy, nginx and similar. Nothing else is on such a page.
|
|
28
28
|
# A publisher's own page for a blocked address: "Your IP has been blocked.", "Your IP
|
|
29
29
|
# 69.63.193.18 has been blocked." (Science, 2026-11-16), "your IP address … has been blocked".
|
|
30
|
-
|
|
30
|
+
# Taylor & Francis (2026-11-25), a page titled "Error" for the article, its PDF and its institution entry alike:
|
|
31
|
+
# "The IP address of 203.0.113.7 has not been recognised to access this page. Please contact … quoting the IP address".
|
|
32
|
+
# Not recognised, the driver took its sign-in button for the school's login and waited on the user each paper,
|
|
33
|
+
# then wrote 没权限. A web firewall's page in Chinese, under that line as the title (Sage's sage.cnpereading.com, HTTP
|
|
34
|
+
# 592, 2026-11-25: "您的访问请求可能对网站造成安全威胁,请求已被阻断"): taken for an article page without a login entry,
|
|
35
|
+
# each paper written 待适配.
|
|
36
|
+
_IP_BLOCKED = re.compile(r"\byour ip(?: address)?(?: [0-9a-f.:]+)? (?:has been|is) blocked\b"
|
|
37
|
+
r"|\bthe ip address (?:of )?[0-9a-f.:]+ has not been recogni[sz]ed to access\b"
|
|
38
|
+
r"|访问请求可能对网站造成安全威胁"
|
|
39
|
+
# A throttle, any site's words for it (Optica, 2026-11-26: "This IP address is subject to a
|
|
40
|
+
# downloading timeout based on heavy usage. Please try again in a few minutes."): by the address,
|
|
41
|
+
r"|\b(?:this|your) ip(?: address)?(?: [0-9a-f.:]+)? (?:has been |is |was )?(?:temporarily )?"
|
|
42
|
+
r"(?:subject to|limited|throttled|rate[- ]limited|restricted|suspended|banned)\b"
|
|
43
|
+
# or by the use, with the time to come back,
|
|
44
|
+
r"|\b(?:heavy|excessive|unusually high|unusual)\s+(?:usage|use|downloading|downloads|requests|traffic"
|
|
45
|
+
r"|activity)\b[^.!?]{0,100}[.!?]?\s*(?:please\s+)?(?:try again|come back|retry)\s+(?:later|in\b|after\b)"
|
|
46
|
+
r"|(?:访问|请求|下载)(?:过于|太|过度)频繁", re.I)
|
|
31
47
|
_GATEWAY_ERROR_MARKERS = (
|
|
32
48
|
"upstream connect error or disconnect/reset before headers",
|
|
33
49
|
"502 bad gateway", "503 service unavailable", "503 service temporarily unavailable",
|
|
@@ -167,11 +183,24 @@ class AccessMixin:
|
|
|
167
183
|
and "you are unable to access" in text)
|
|
168
184
|
|
|
169
185
|
@staticmethod
|
|
170
|
-
def
|
|
171
|
-
"""The publisher's own
|
|
172
|
-
2026-11-16: "Your IP 69.63.193.18 has been blocked."
|
|
173
|
-
|
|
174
|
-
|
|
186
|
+
def _ip_blocked_words(text: str) -> str:
|
|
187
|
+
"""The publisher's own words that it blocks or throttles this address, under its usual
|
|
188
|
+
title (Science, 2026-11-16: "Your IP 69.63.193.18 has been blocked."; Optica, 2026-11-26:
|
|
189
|
+
"This IP address is subject to a downloading timeout based on heavy usage. Please try
|
|
190
|
+
again in a few minutes."): no login opens it, and the site's other addresses answer the
|
|
191
|
+
same; "" for any other page. Read from the page's text: the article page's, which the
|
|
192
|
+
access check reads anyway (``_access_snapshot``), and the page a PDF attempt ended on."""
|
|
193
|
+
# Its start, and its end: Taylor & Francis writes it after the site's whole header, Optica before its footer.
|
|
194
|
+
window = " ".join((str(text or "")[:4000] + "\n" + str(text or "")[-2000:]).split())
|
|
195
|
+
found = _IP_BLOCKED.search(window)
|
|
196
|
+
if found:
|
|
197
|
+
return window[max(0, found.start() - 60):found.end() + 80]
|
|
198
|
+
# A bare 429 page ("Too Many Requests"), not an article that names the status.
|
|
199
|
+
return window[:200] if len(window) <= 1500 and "too many requests" in window.lower() else ""
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def _ip_blocked_text(cls, text: str) -> bool:
|
|
203
|
+
return bool(cls._ip_blocked_words(text))
|
|
175
204
|
|
|
176
205
|
def _raise_on_publisher_access_blocked(self, page: Any) -> None:
|
|
177
206
|
if self._publisher_access_blocked(page):
|
|
@@ -264,7 +293,12 @@ class AccessMixin:
|
|
|
264
293
|
def _article_access_available(self, page: Any) -> bool:
|
|
265
294
|
"""The article page no longer says the reader is signed out: the PDF
|
|
266
295
|
decides. In the login that follows a failed PDF, only the institution's
|
|
267
|
-
session or a completed login round trip count
|
|
296
|
+
session or a completed login round trip count, and on the site the adapter
|
|
297
|
+
sent the login to (``_on_login_site``) also access every reader has there
|
|
298
|
+
(``access_rules.OPEN_TO_ALL``: an open-access badge or licence): that page is
|
|
299
|
+
not the one whose PDF failed. Not "Full text access" alone: ScienceDirect
|
|
300
|
+
shows it for full text through ClinicalKey or a personal account, with no PDF
|
|
301
|
+
(J Hepatol, 2026-10-31), and the school's login there is still to be done."""
|
|
268
302
|
# A verification/error page can retain the exact article URL. Its
|
|
269
303
|
# lack of a sign-in button is not evidence of full-text access.
|
|
270
304
|
if page.is_closed() is True:
|
|
@@ -274,15 +308,26 @@ class AccessMixin:
|
|
|
274
308
|
return False
|
|
275
309
|
if self._institution_pdf_entitlement_missing(page):
|
|
276
310
|
return False
|
|
277
|
-
|
|
311
|
+
url = str(getattr(page, "url", "") or "")
|
|
312
|
+
if not self._is_success_article_url(url):
|
|
278
313
|
return False
|
|
279
|
-
verdict, basis,
|
|
314
|
+
verdict, basis, evidence = self._access_decision(page)
|
|
280
315
|
if verdict == access_rules.OUT:
|
|
281
316
|
return False
|
|
282
317
|
if basis == "session" or self._school_login_done():
|
|
283
318
|
return True
|
|
284
319
|
# The login that follows a failed PDF waits for the school's login itself.
|
|
285
|
-
|
|
320
|
+
result = getattr(self, "_item_result", None)
|
|
321
|
+
if not getattr(result, "_pdf_retry_login", False):
|
|
322
|
+
return True
|
|
323
|
+
# Its sign-in sent to this article on another site, open to every reader there:
|
|
324
|
+
# the PDF is taken there (ScienceDirect's "Open access" for jacc.org's 403, 2026-11-23).
|
|
325
|
+
if (verdict != access_rules.IN or not access_rules.OPEN_TO_ALL.search(evidence.split("badge: ", 1)[-1])
|
|
326
|
+
or not self._on_login_site(page, result)):
|
|
327
|
+
return False
|
|
328
|
+
if not any(e["state"] == "login_site_article_readable" for e in result.events):
|
|
329
|
+
self._event(result, "login_site_article_readable", f"{url[:160]} | {verdict} ({basis}): {evidence[:160]}")
|
|
330
|
+
return True
|
|
286
331
|
|
|
287
332
|
def _school_login_done(self) -> bool:
|
|
288
333
|
"""This item reached its IdP; selecting a school is only an attempt."""
|
|
@@ -311,17 +356,18 @@ class AccessMixin:
|
|
|
311
356
|
return True
|
|
312
357
|
return bool(named) and self._names_configured_school(named)
|
|
313
358
|
|
|
314
|
-
def _no_access_after_login(self, page: Any, result: DownloadResult) -> str:
|
|
315
|
-
"""Evidence that the article page, after this item's school login
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
359
|
+
def _no_access_after_login(self, page: Any, result: DownloadResult, *, session_shown: bool = False) -> str:
|
|
360
|
+
"""Evidence that the article page, after this item's school login (or with
|
|
361
|
+
the school's session shown on it, ``session_shown``: signed in by an earlier
|
|
362
|
+
item), still denies the article, shows only its abstract, offers it for sale
|
|
363
|
+
or is the site's signed-out page type; "" otherwise, and while the site's own
|
|
364
|
+
login pages remain to be opened (an Elsevier journal's site signs in on itself,
|
|
319
365
|
then on ScienceDirect) or the login site's own article remains to be tried
|
|
320
366
|
(``_return_from_login_site``). Not the "Access through <school>" gate: that
|
|
321
367
|
is a remembered school not signed in on this site."""
|
|
322
368
|
url = str(getattr(page, "url", "") or "")
|
|
323
369
|
if (not self._is_success_article_url(url) or self._is_auth_page(url)
|
|
324
|
-
or self._is_challenge_page(page) or not self._school_login_done()):
|
|
370
|
+
or self._is_challenge_page(page) or not (session_shown or self._school_login_done())):
|
|
325
371
|
return ""
|
|
326
372
|
opened = {e.get("detail") for e in result.events if e["state"] == "login_page_opened"}
|
|
327
373
|
if any(target not in opened for target in self.adapter.login_page_urls(page)):
|