papersearch 0.7.3 → 0.8.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.
Files changed (170) hide show
  1. package/LICENSE-paper-search-mcp-nodejs +24 -0
  2. package/NOTICE +8 -37
  3. package/README.en.md +7 -3
  4. package/README.fr.md +268 -0
  5. package/README.ja.md +268 -0
  6. package/README.ko.md +268 -0
  7. package/README.md +7 -3
  8. package/README.zh-Hant.md +268 -0
  9. package/dist/capabilities/download/batch/batch.d.ts +16 -1
  10. package/dist/capabilities/download/batch/batch.d.ts.map +1 -1
  11. package/dist/capabilities/download/batch/batch.js +389 -56
  12. package/dist/capabilities/download/batch/batch.js.map +1 -1
  13. package/dist/capabilities/download/batch/batchFolder.d.ts.map +1 -1
  14. package/dist/capabilities/download/batch/batchFolder.js +3 -2
  15. package/dist/capabilities/download/batch/batchFolder.js.map +1 -1
  16. package/dist/capabilities/download/batch/networkLoss.d.ts +11 -2
  17. package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -1
  18. package/dist/capabilities/download/batch/networkLoss.js +24 -3
  19. package/dist/capabilities/download/batch/networkLoss.js.map +1 -1
  20. package/dist/capabilities/download/batch/resume.d.ts +7 -0
  21. package/dist/capabilities/download/batch/resume.d.ts.map +1 -1
  22. package/dist/capabilities/download/batch/resume.js +50 -9
  23. package/dist/capabilities/download/batch/resume.js.map +1 -1
  24. package/dist/capabilities/download/content/markdown/pro.d.ts +6 -0
  25. package/dist/capabilities/download/content/markdown/pro.d.ts.map +1 -1
  26. package/dist/capabilities/download/content/markdown/pro.js.map +1 -1
  27. package/dist/capabilities/download/content/markdown/shortfall.d.ts +8 -5
  28. package/dist/capabilities/download/content/markdown/shortfall.d.ts.map +1 -1
  29. package/dist/capabilities/download/content/markdown/shortfall.js +22 -10
  30. package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -1
  31. package/dist/capabilities/download/content/markdown/step.d.ts +9 -0
  32. package/dist/capabilities/download/content/markdown/step.d.ts.map +1 -1
  33. package/dist/capabilities/download/content/markdown/step.js +42 -2
  34. package/dist/capabilities/download/content/markdown/step.js.map +1 -1
  35. package/dist/capabilities/download/content/markdown/types.d.ts +10 -1
  36. package/dist/capabilities/download/content/markdown/types.d.ts.map +1 -1
  37. package/dist/capabilities/download/handler.d.ts.map +1 -1
  38. package/dist/capabilities/download/handler.js +13 -5
  39. package/dist/capabilities/download/handler.js.map +1 -1
  40. package/dist/capabilities/download/outputLayout.d.ts.map +1 -1
  41. package/dist/capabilities/download/outputLayout.js +3 -1
  42. package/dist/capabilities/download/outputLayout.js.map +1 -1
  43. package/dist/capabilities/download/tools.js +2 -2
  44. package/dist/capabilities/download/tools.js.map +1 -1
  45. package/dist/capabilities/download/types.d.ts +9 -1
  46. package/dist/capabilities/download/types.d.ts.map +1 -1
  47. package/dist/cli.js +3 -1
  48. package/dist/cli.js.map +1 -1
  49. package/dist/infrastructure/runlog/RunLedger.d.ts +7 -0
  50. package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
  51. package/dist/infrastructure/runlog/RunLedger.js +13 -0
  52. package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
  53. package/dist/infrastructure/runlog/failureClass.d.ts +2 -1
  54. package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
  55. package/dist/infrastructure/runlog/failureClass.js +27 -4
  56. package/dist/infrastructure/runlog/failureClass.js.map +1 -1
  57. package/dist/infrastructure/school/SchoolAttempt.d.ts +11 -0
  58. package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -1
  59. package/dist/infrastructure/school/SchoolAttempt.js +48 -5
  60. package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
  61. package/dist/infrastructure/school/SchoolMcpClient.d.ts +1 -0
  62. package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
  63. package/dist/infrastructure/school/SchoolMcpClient.js +18 -6
  64. package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -1
  65. package/dist/infrastructure/school/SchoolProgress.d.ts +2 -0
  66. package/dist/infrastructure/school/SchoolProgress.d.ts.map +1 -1
  67. package/dist/infrastructure/school/SchoolProgress.js +2 -0
  68. package/dist/infrastructure/school/SchoolProgress.js.map +1 -1
  69. package/dist/infrastructure/school/SchoolReadiness.d.ts +2 -0
  70. package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -1
  71. package/dist/infrastructure/school/SchoolReadiness.js +2 -0
  72. package/dist/infrastructure/school/SchoolReadiness.js.map +1 -1
  73. package/dist/infrastructure/school/SchoolResultNormalizer.d.ts.map +1 -1
  74. package/dist/infrastructure/school/SchoolResultNormalizer.js +4 -0
  75. package/dist/infrastructure/school/SchoolResultNormalizer.js.map +1 -1
  76. package/dist/infrastructure/school/index.d.ts +2 -2
  77. package/dist/infrastructure/school/index.d.ts.map +1 -1
  78. package/dist/infrastructure/school/index.js +1 -1
  79. package/dist/infrastructure/school/index.js.map +1 -1
  80. package/dist/infrastructure/school/types.d.ts +42 -0
  81. package/dist/infrastructure/school/types.d.ts.map +1 -1
  82. package/dist/infrastructure/school/types.js.map +1 -1
  83. package/dist/management/failures/index.d.ts +23 -0
  84. package/dist/management/failures/index.d.ts.map +1 -1
  85. package/dist/management/failures/index.js +63 -18
  86. package/dist/management/failures/index.js.map +1 -1
  87. package/package.json +7 -2
  88. package/school/NOTICE +3 -2
  89. package/school/paper_search_school/adapters/__init__.py +2 -0
  90. package/school/paper_search_school/adapters/aps/__init__.py +3 -6
  91. package/school/paper_search_school/adapters/base.py +16 -2
  92. package/school/paper_search_school/adapters/copernicus/__init__.py +2 -7
  93. package/school/paper_search_school/adapters/elsevier/__init__.py +50 -1
  94. package/school/paper_search_school/adapters/frontiers/__init__.py +41 -2
  95. package/school/paper_search_school/adapters/ieee/__init__.py +6 -4
  96. package/school/paper_search_school/adapters/iop/__init__.py +8 -0
  97. package/school/paper_search_school/adapters/jama/__init__.py +8 -0
  98. package/school/paper_search_school/adapters/lww/__init__.py +14 -6
  99. package/school/paper_search_school/adapters/mdpi/__init__.py +12 -7
  100. package/school/paper_search_school/adapters/neurology/__init__.py +5 -2
  101. package/school/paper_search_school/adapters/optica/__init__.py +2 -9
  102. package/school/paper_search_school/adapters/oup/__init__.py +7 -4
  103. package/school/paper_search_school/adapters/platforms/__init__.py +4 -1
  104. package/school/paper_search_school/adapters/platforms/atypon/__init__.py +8 -0
  105. package/school/paper_search_school/adapters/platforms/jstage/__init__.py +64 -0
  106. package/school/paper_search_school/adapters/taylor_francis/__init__.py +0 -3
  107. package/school/paper_search_school/adapters/thieme/__init__.py +2 -9
  108. package/school/paper_search_school/api_keys.py +63 -13
  109. package/school/paper_search_school/assets/api_keys.json +14 -0
  110. package/school/paper_search_school/assets/capsule.html +156 -116
  111. package/school/paper_search_school/assets/capsule_en.json +69 -46
  112. package/school/paper_search_school/assets/capsule_fr.json +70 -47
  113. package/school/paper_search_school/assets/capsule_ja.json +69 -46
  114. package/school/paper_search_school/assets/capsule_ko.json +69 -46
  115. package/school/paper_search_school/assets/capsule_zh-Hant.json +68 -45
  116. package/school/paper_search_school/browser/batch_session.py +1 -1
  117. package/school/paper_search_school/browser/challenge/__init__.py +12 -9
  118. package/school/paper_search_school/browser/challenge/continuation.py +65 -0
  119. package/school/paper_search_school/browser/challenge/handlers/__init__.py +1 -0
  120. package/school/paper_search_school/browser/challenge/handlers/aws_waf.py +260 -0
  121. package/school/paper_search_school/browser/challenge/handlers/recaptcha_hcaptcha.py +167 -0
  122. package/school/paper_search_school/browser/challenge/handlers/text_captcha.py +100 -0
  123. package/school/paper_search_school/browser/challenge/handlers/turnstile.py +174 -0
  124. package/school/paper_search_school/browser/challenge/kinds.py +203 -0
  125. package/school/paper_search_school/browser/challenge/local/__init__.py +1 -0
  126. package/school/paper_search_school/browser/challenge/{interaction.py → local/interaction.py} +94 -13
  127. package/school/paper_search_school/browser/challenge/{pointer.py → local/pointer.py} +2 -2
  128. package/school/paper_search_school/browser/challenge/local/prompt.py +283 -0
  129. package/school/paper_search_school/browser/challenge/local/submission.py +33 -0
  130. package/school/paper_search_school/browser/challenge/services/__init__.py +1 -0
  131. package/school/paper_search_school/browser/challenge/services/solver.py +272 -0
  132. package/school/paper_search_school/cli_config.py +10 -5
  133. package/school/paper_search_school/config.py +11 -10
  134. package/school/paper_search_school/download_diagnostics.py +7 -2
  135. package/school/paper_search_school/engine/access_rules.py +12 -3
  136. package/school/paper_search_school/engine/batch.py +43 -11
  137. package/school/paper_search_school/engine/batch_access.py +38 -12
  138. package/school/paper_search_school/engine/batch_capture.py +215 -18
  139. package/school/paper_search_school/engine/batch_common.py +3 -0
  140. package/school/paper_search_school/engine/batch_diagnostics.py +25 -5
  141. package/school/paper_search_school/engine/batch_institution.py +38 -3
  142. package/school/paper_search_school/engine/batch_login.py +223 -16
  143. package/school/paper_search_school/engine/batch_pdf_urls.py +38 -7
  144. package/school/paper_search_school/engine/batch_waits.py +179 -12
  145. package/school/paper_search_school/engine/bridge.py +28 -4
  146. package/school/paper_search_school/engine/fulltext_page.py +45 -7
  147. package/school/paper_search_school/engine/router.py +16 -1
  148. package/school/paper_search_school/entitlements.py +1 -1
  149. package/school/paper_search_school/pdf_utils.py +25 -16
  150. package/school/paper_search_school/progress_capsule.py +36 -6
  151. package/school/paper_search_school/progress_reporter.py +54 -5
  152. package/school/paper_search_school/progress_view.py +63 -43
  153. package/school/paper_search_school/publishers/builtin/iop.json +2 -1
  154. package/school/paper_search_school/publishers/builtin/neurology.json +4 -2
  155. package/school/paper_search_school/publishers/site.py +12 -4
  156. package/school/paper_search_school/school_test.py +1 -1
  157. package/school/paper_search_school/server.py +17 -6
  158. package/school/paper_search_school/user_settings.py +13 -0
  159. package/school/pyproject.toml +1 -0
  160. package/skills/paper-search/SKILL.md +107 -107
  161. package/skills/paper-search/references/browser-download.md +102 -99
  162. package/skills/paper-search/references/capability-routing.md +89 -89
  163. package/skills/paper-search/references/cli-contract.md +78 -78
  164. package/skills/paper-search/references/federation-support.md +172 -172
  165. package/skills/paper-search/references/management-layer.md +78 -78
  166. package/skills/paper-search/references/publisher-support.md +38 -38
  167. package/skills/paper-search/references/school-setup.md +56 -55
  168. package/skills/paper-search/references/setup.md +20 -20
  169. package/skills/paper-search/references/troubleshooting.md +12 -12
  170. package/school/paper_search_school/browser/challenge/prompt.py +0 -154
@@ -9,6 +9,7 @@ import re
9
9
  from typing import Any
10
10
  from urllib.parse import unquote, urlparse
11
11
 
12
+ from ...engine.fulltext_page import paragraph_text_js
12
13
  from ...engine.router import _append_copernicus_candidates
13
14
  from ..base import PublisherAdapter, SupplementLink, register
14
15
 
@@ -25,13 +26,7 @@ _SUPPLEMENT_ROWS_JS = """() => [...document.querySelectorAll('a[href]')].map(a =
25
26
  # is only an image (div.table-wrap > a.table-link). MathJax 2 keeps each formula's MathML in
26
27
  # a script beside its output, so nothing is prepared (Atmospheric Chemistry and Physics,
27
28
  # 2026-11-15).
28
- FULLTEXT_SHOWN_JS = """() => {
29
- const sections = document.querySelectorAll('div.article > div.sec[id^="section"]:not(.ref-list)');
30
- const text = [...sections].flatMap((section) => [...section.querySelectorAll('p')])
31
- .filter((p) => !p.closest('.downloads, .caption'))
32
- .reduce((total, p) => total + (p.textContent || '').length, 0);
33
- return text > 500;
34
- }"""
29
+ FULLTEXT_SHOWN_JS = paragraph_text_js('div.article > div.sec[id^="section"]:not(.ref-list) p', ".downloads, .caption", "> 500")
35
30
  FULLTEXT_IMAGES_JS = """() => {
36
31
  const article = document.querySelector('div.article');
37
32
  if (!article) return [];
@@ -34,6 +34,24 @@ from .sciencedirect import ScienceDirectSite
34
34
  # ClinicalKey (clinicalkey.com, .fr, .es, .com.au, ...): EMC titles are served
35
35
  # only there, a separate subscription with its own sign-in and reader.
36
36
  _CLINICALKEY = re.compile(r"(?:www\.)?clinicalkey\.[a-z]{2,3}(?:\.[a-z]{2})?")
37
+ # EM-Consulte (em-consulte.com), Elsevier Masson's French platform: as ClinicalKey, a
38
+ # subscription with its own sign-in and reader, its titles without a ScienceDirect page.
39
+ # La Revue de Santé Scolaire et Universitaire (10.1016/j.revssu.2025.09.004, Windows
40
+ # 2026-11-23): an abstract there, no school login found, its PDF control an HTML answer,
41
+ # the PII's ScienceDirect page "Page not found"; it ended as pdf_not_captured.
42
+ _EM_CONSULTE = re.compile(r"(?:www\.)?em-consulte\.com")
43
+ # linkinghub's own page when it has no site to send the DOI to by itself (doi.org's
44
+ # address for every Elsevier DOI is linkinghub's /retrieve/pii/<PII>): "Elsevier: Article
45
+ # Locator", offering the article on Elsevier's other platforms (La Revue de l'Infirmière and
46
+ # Soins Cadres: EM-Consulte), or "Elsevier: Article Locator Error - Article Not Available"
47
+ # (EMC - Podologie; Anais Brasileiros de Dermatologia (Versão em Português)). ScienceDirect has
48
+ # no page for the PII either: its "Page not found" was taken as the publisher's error, or the
49
+ # item ended as pdf_not_captured, 100-160 s each (Windows, 2026-11-23).
50
+ _LINKINGHUB = "linkinghub.elsevier.com"
51
+ _LOCATOR_TITLE = "elsevier: article locator"
52
+ # The sites the locator offers: each choice carries its address as its value.
53
+ _LOCATOR_SITES_JS = """() => [...document.querySelectorAll('[value]')]
54
+ .map((el) => (el.getAttribute('value') || '').trim()).filter((value) => /^https?:\\/\\//i.test(value))"""
37
55
  _ASH_DOI = re.compile(r"10\.1182/(?:blood|bloodadvances)\.[^/?#\s]+", re.I)
38
56
  _ASH_HOSTS = frozenset({"ashpublications.org", "www.ashpublications.org"})
39
57
 
@@ -385,7 +403,35 @@ class ElsevierAdapter(PublisherAdapter):
385
403
  host = (urlparse(url).hostname or "").lower()
386
404
  if _CLINICALKEY.fullmatch(host) or (sciencedirect.is_page(url) and self.sciencedirect.clinicalkey_only(page)):
387
405
  return "ClinicalKey"
388
- return None
406
+ if _EM_CONSULTE.fullmatch(host):
407
+ return "EM-Consulte"
408
+ return self._locator_platforms(page) if host == _LINKINGHUB else None
409
+
410
+ def _locator_platforms(self, page: Any) -> str | None:
411
+ """linkinghub's Article Locator offering the article on platforms without rules
412
+ only: their names ("EM-Consulte", "ClinicalKey"); None for its other pages
413
+ ("Redirecting", the locator's error), and for a locator offering a site with
414
+ rules (ScienceDirect, a journal's own) or none."""
415
+ if self.d._title(page).strip().lower() != _LOCATOR_TITLE:
416
+ return None
417
+ try:
418
+ offered = page.evaluate(_LOCATOR_SITES_JS)
419
+ except Exception as exc:
420
+ if not is_driver_error(exc):
421
+ raise
422
+ return None # the page moved on while it was read
423
+ names: list[str] = []
424
+ for value in offered if isinstance(offered, list) else []:
425
+ host = (urlparse(str(value)).hostname or "").lower()
426
+ if host == "elsevier.com" or host.endswith(".elsevier.com"):
427
+ continue # Elsevier's own pages (its home, linkinghub itself): no site to read the article on
428
+ name = ("ClinicalKey" if _CLINICALKEY.fullmatch(host)
429
+ else "EM-Consulte" if _EM_CONSULTE.fullmatch(host) else "")
430
+ if not name:
431
+ return None
432
+ if name not in names:
433
+ names.append(name)
434
+ return " / ".join(names) or None
389
435
 
390
436
  def supplements_page_urls(self, doi: str) -> list[str]:
391
437
  """ScienceDirect first; journals on their own Elsevier site (Cell Press,
@@ -423,6 +469,9 @@ class ElsevierAdapter(PublisherAdapter):
423
469
 
424
470
  def content_error(self, page: Any) -> bool:
425
471
  url = str(getattr(page, "url", "") or "")
472
+ if (urlparse(url).hostname or "").lower() == _LINKINGHUB:
473
+ # The locator's "Article Not Available": no site of Elsevier's has the article.
474
+ return self.d._title(page).strip().lower().startswith(_LOCATOR_TITLE + " error")
426
475
  return self.sciencedirect.content_error(page) if sciencedirect.is_page(url) else False
427
476
 
428
477
  def open_pdf_entry(self, page: Any, result: Any) -> bool | None:
@@ -1,10 +1,11 @@
1
- """Frontiers: open-access journals on www.frontiersin.org; supplementary files on the article's own download panel."""
1
+ """Frontiers: open-access journals on www.frontiersin.org (Frontiers for Young Minds on kids.frontiersin.org); supplementary files on the article's own download panel."""
2
2
  from __future__ import annotations
3
3
 
4
4
  import re
5
5
  from typing import Any
6
6
  from urllib.parse import unquote, urlparse
7
7
 
8
+ from ...engine.fulltext_page import paragraph_text_js
8
9
  from ..base import PublisherAdapter, SupplementLink, register
9
10
 
10
11
  _SUPPLEMENT_ROWS_JS = """() => ({
@@ -15,6 +16,10 @@ _SUPPLEMENT_ROWS_JS = """() => ({
15
16
  }))
16
17
  })"""
17
18
 
19
+ # The original of an image the site's resizer serves (/api/ipx/w=287&f=webp&v=7/<original>), as
20
+ # the converter takes it back (sites/publishers/frontiers/template.ts's original()).
21
+ _ORIGINAL_JS = "const original = (url) => (/\\/api\\/ipx\\/[^/]*\\/(https?:\\/\\/.+)$/.exec(url) || [])[1] || url;"
22
+
18
23
  # --fulltext (PaperSearch Pro's sites/publishers/frontiers/template.ts). The article page
19
24
  # (/journals/<journal>/articles/<DOI>/full, open access) holds the article in
20
25
  # div.ArticleContent, in parts side by side: the abstract (a div whose h2 is "Abstract"),
@@ -42,7 +47,7 @@ FULLTEXT_SHOWN_JS = """() => {
42
47
  FULLTEXT_IMAGES_JS = """() => {
43
48
  const content = document.querySelector('div.ArticleContent');
44
49
  if (!content) return [];
45
- const original = (url) => (/\\/api\\/ipx\\/[^/]*\\/(https?:\\/\\/.+)$/.exec(url) || [])[1] || url;
50
+ """ + _ORIGINAL_JS + """
46
51
  const caption = 'figcaption, .ArticleTable__description, .ArticleTable__foot';
47
52
  const image = (float) => {
48
53
  const img = [...float.querySelectorAll('img')].find((node) => !node.closest(caption));
@@ -59,6 +64,31 @@ FULLTEXT_IMAGES_JS = """() => {
59
64
  }"""
60
65
 
61
66
 
67
+ # --fulltext for Frontiers for Young Minds (PaperSearch Pro's
68
+ # sites/publishers/frontiers/templateYoungMinds.ts). kids.frontiersin.org is another page than
69
+ # www.frontiersin.org's: no div.ArticleContent, which the scripts above wait for, so its two papers
70
+ # of the publisher sweep were said to show no full text when their PDFs were taken (2026-11-22).
71
+ # The server renders the article in div.fulltext-content, flat: div.abstract, the paragraphs and
72
+ # h2/h3 headings, the exercise boxes, the glossary, then section#full-text-references. A figure is
73
+ # a <figure>: its <img> lazy (src empty, data-src the resizer's address of the original,
74
+ # /api/ipx/w=1200&f=webp/<files/Articles/…/image_m/figure-1.jpg>), taken back to the original as
75
+ # the converter does; the main illustration and the people's photos are not in the article.
76
+ YOUNG_MINDS_FULLTEXT_SHOWN_JS = paragraph_text_js("p", "div.abstract, section#full-text-references, figure", "> 500",
77
+ root="div.fulltext div.fulltext-content")
78
+ YOUNG_MINDS_FULLTEXT_IMAGES_JS = """() => {
79
+ const content = document.querySelector('div.fulltext div.fulltext-content');
80
+ if (!content) return [];
81
+ """ + _ORIGINAL_JS + """
82
+ return [...content.querySelectorAll('figure')].map((figure) => {
83
+ const img = figure.querySelector('img');
84
+ return [img?.getAttribute('data-src'), img?.getAttribute('src')]
85
+ .filter((value) => value && !value.startsWith('data:'))
86
+ .map((value) => { try { return new URL(original(value), location.href).href; } catch (error) { return ''; } })
87
+ .find((url) => /^https?:/i.test(url)) || '';
88
+ }).filter(Boolean);
89
+ }"""
90
+
91
+
62
92
  def supplement_links_from_page(data: Any, doi: str) -> list[SupplementLink]:
63
93
  """The panel, citation DOI and file's article ID must all agree."""
64
94
  article = re.fullmatch(r"10\.3389/[a-z0-9]+\.\d{4}\.(\d+)", doi, re.I)
@@ -88,3 +118,12 @@ class FrontiersAdapter(PublisherAdapter):
88
118
 
89
119
  def supplement_links(self, page: Any, doi: str) -> list[SupplementLink]:
90
120
  return supplement_links_from_page(page.evaluate(_SUPPLEMENT_ROWS_JS), doi)
121
+
122
+
123
+ @register
124
+ class FrontiersForYoungMindsAdapter(FrontiersAdapter):
125
+ """Frontiers for Young Minds on kids.frontiersin.org: its article page's own scripts, the rest Frontiers'."""
126
+
127
+ hosts = ("kids.frontiersin.org",)
128
+ fulltext_shown_js = YOUNG_MINDS_FULLTEXT_SHOWN_JS
129
+ fulltext_images_js = YOUNG_MINDS_FULLTEXT_IMAGES_JS
@@ -116,16 +116,18 @@ FULLTEXT_IMAGES_JS = """() => {
116
116
  # /rest/document/<number>/references when opened. Before the page is read they are fetched
117
117
  # from the article page (same origin, the session's cookies), 30 at a time (a later page
118
118
  # starts at its start= entry, the previous page's last one again: entries are kept once),
119
- # up to the page's referenceCount, 5 s a request and 10 s in all (the page read has 50 s,
120
- # batch_capture.FULLTEXT_READ_SEC), and written into the page as
119
+ # up to the page's referenceCount, 5 s a request and 18 s in all (the page read has 50 s,
120
+ # batch_capture.FULLTEXT_READ_SEC, its body's wait at most 31 s), and written into the page as
121
121
  # script#papersearch-ieee-references (JSON), which the converter reads. Without them it
122
- # reports the references as incomplete.
122
+ # reports the references as incomplete. 10 s in all gave 7 pages, 204 of an article's 261
123
+ # entries (IEEE Open Journal of the Communications Society, Windows 2026-11-25: 30 a page, then
124
+ # 29 new each, about 1.4 s a request).
123
125
  FULLTEXT_PREPARE_JS = r"""async () => {
124
126
  const metadata = window.xplGlobal?.document?.metadata || {};
125
127
  const number = String(metadata.articleNumber || (location.pathname.match(/^\/document\/(\d+)/) || [])[1] || '');
126
128
  const expected = Number(metadata.referenceCount) || 0;
127
129
  if (!/^\d+$/.test(number) || metadata.referenceCount === 0) return 0;
128
- const deadline = Date.now() + 10000;
130
+ const deadline = Date.now() + 18000;
129
131
  const references = [];
130
132
  const seen = new Set();
131
133
  for (let page = 0; page < 40; page += 1) {
@@ -123,6 +123,14 @@ class IOPAdapter(PublisherAdapter):
123
123
  fulltext_images_js = FULLTEXT_IMAGES_JS
124
124
  fulltext_prepare_js = FULLTEXT_PREPARE_JS
125
125
 
126
+ def server_error_page(self, page: Any) -> str:
127
+ # In place of the article, a page with only the site's header and footer, titled
128
+ # "IOPscience::.. Error!": five subscription articles of a resumed batch, each then went
129
+ # through the PDF and the login to 没取到 PDF; the same pages opened normally later
130
+ # (Windows, 2026-11-25).
131
+ title = self.d._title(page)
132
+ return title if title.lower() == "iopscience::.. error!" else ""
133
+
126
134
  def supplements_page_urls(self, doi: str) -> list[str]:
127
135
  return [f"https://iopscience.iop.org/article/{doi}/data"]
128
136
 
@@ -41,6 +41,14 @@ class JAMAAdapter(PublisherAdapter):
41
41
  fulltext_shown_js = SILVERCHAIR_FULLTEXT_SHOWN_JS
42
42
  fulltext_images_js = SILVERCHAIR_FULLTEXT_IMAGES_JS
43
43
 
44
+ @classmethod
45
+ def covers_site(cls, url: str) -> bool | None:
46
+ # JAMA Network only. The AMA Journal of Ethics (journalofethics.ama-assn.org) shares the
47
+ # 10.1001 prefix on a site of its own, which these rules took for no article page: its
48
+ # open articles ended with no PDF tried (10.1001/amajethics.2025.821, Windows 2026-11-23).
49
+ host = (urlparse(url).hostname or "").lower()
50
+ return host == "jamanetwork.com" or host.endswith(".jamanetwork.com")
51
+
44
52
  @classmethod
45
53
  def names_supplement(cls, url: str) -> bool:
46
54
  return bool(re.search(r"supp\d+(?:[_\W]|$)", url)) # JAMA's supplement files: supp1, supp2, ...
@@ -1,7 +1,8 @@
1
1
  """Wolters Kluwer / LWW: publisher-wide answers and two site types.
2
2
 
3
- LWWAdapter (this module) the PDF (always Ovid's), the Wolters Kluwer
4
- login page's federated option
3
+ LWWAdapter (this module) the PDF (Ovid's, or journals.lww.com's own for
4
+ a journal still shown there), the Wolters
5
+ Kluwer login page's federated option
5
6
  ├─ JournalsLwwSite (journals_lww.py) journals.lww.com article pages
6
7
  └─ OvidSite (ovid.py) ovid.com/jnls/ article pages
7
8
 
@@ -20,6 +21,9 @@ from .journals_lww import JournalsLwwSite
20
21
  from .ovid import OvidSite
21
22
 
22
23
  _PDF = re.compile(r"/jnls/[^/]+/pdf/(10\.\d{4,9}/.+|\d{8}-\d{9}-\d{5})")
24
+ # A journal still shown on journals.lww.com serves its PDF there, at the DOI
25
+ # (Critical Care Medicine's /ccmjournal/pdf/10.1097/ccm...~title, 2026-11-25).
26
+ _LWW_PDF = re.compile(r"/[^/]+/pdf/(10\.\d{4,9}/.+)")
23
27
  SDC_HOST = "links.lww.com"
24
28
  # The article's "Supplemental Digital Content" list (Ovid: .lww-article-sdc).
25
29
  _SUPPLEMENT_ROWS_JS = """() => [...document.querySelectorAll('a[href*="links.lww.com/"]')].map(a => ({
@@ -32,7 +36,8 @@ class LWWAdapter(PublisherAdapter):
32
36
  publisher = "lww"
33
37
  validates_article_pdf = True
34
38
  keeps_pdf_out_of_downloads = True
35
- native_pdf_patterns = ("https://www.ovid.com/jnls/*/pdf/*", "https://ovid.com/jnls/*/pdf/*")
39
+ native_pdf_patterns = ("https://www.ovid.com/jnls/*/pdf/*", "https://ovid.com/jnls/*/pdf/*",
40
+ "https://journals.lww.com/*/pdf/*")
36
41
  # --fulltext: the article page is Ovid's (journals.lww.com links lead there); its rules are ovid.py's.
37
42
  fulltext_shown_js = ovid.FULLTEXT_SHOWN_JS
38
43
  fulltext_images_js = ovid.FULLTEXT_IMAGES_JS
@@ -52,14 +57,17 @@ class LWWAdapter(PublisherAdapter):
52
57
  return ovid.is_redirect(url)
53
58
 
54
59
  def is_article_pdf_url(self, url: str, doi: str = "") -> bool | None:
55
- # The PDF is always Ovid's, also for articles shown on journals.lww.com.
60
+ # Ovid's PDF, also for most articles shown on journals.lww.com; a journal
61
+ # still shown there has its own (_LWW_PDF).
56
62
  parsed = urlparse(url)
57
63
  path = unquote(parsed.path).lower().split("~", 1)[0].rstrip("/")
58
- match = _PDF.fullmatch(path)
64
+ host = parsed.hostname
65
+ match = (_PDF.fullmatch(path) if host in ovid.HOSTS
66
+ else _LWW_PDF.fullmatch(path) if host == journals_lww.HOST else None)
59
67
  # Older Ovid URLs use the numeric article ID (the DOI suffix), without
60
68
  # its registrant prefix. Still require the exact requested article.
61
69
  identifiers = {doi.lower(), doi.lower().partition("/")[2]} if doi else set()
62
- return (parsed.scheme == "https" and parsed.hostname in ovid.HOSTS
70
+ return (parsed.scheme == "https"
63
71
  and match is not None and (not doi or match[1] in identifiers)
64
72
  and not self.d._is_supplementary_url(url))
65
73
 
@@ -6,6 +6,7 @@ from the DOI for the journals whose codes are known.
6
6
  from __future__ import annotations
7
7
 
8
8
  import re
9
+ import time
9
10
  from typing import Any
10
11
  from urllib.parse import unquote, urlparse
11
12
 
@@ -103,17 +104,21 @@ class MDPIAdapter(PublisherAdapter):
103
104
  fulltext_prepare_js = MATHJAX_SOURCES_JS
104
105
 
105
106
  def fulltext_page_url(self, doi: str, page_url: str) -> str:
106
- """--fulltext: the article page again, at its address with MDPI's update-check query.
107
- On a repeat visit MDPI may answer the bare address with the abstract alone (a 120-140 kB
108
- document with one div.html-p; the full page is 230-800 kB, its Akamai check passed or
109
- not), and keeps doing so for that address; the same address with a query is the full
110
- page every time (Energies 10.3390/en19215280, -5291, three of ten said 文章页没有正文,
111
- 2026-11-18). "" off MDPI's article pages, or when the address has a query already."""
107
+ """--fulltext: the article page again, at its address with MDPI's update-check query and
108
+ a value of this read's own, for when the article page shows no full text. MDPI may answer
109
+ an article's address with the abstract alone (a 120-140 kB document with one div.html-p;
110
+ the full page is 230-800 kB) and keeps doing so for that address: the bare one on a repeat
111
+ visit (Energies 10.3390/en19215280, -5291, 2026-11-18), and the one with the update-check
112
+ query too, for 16 of 80 articles of 2025 (10.3390/s25226876: the same abstract-only page
113
+ on two reads 30 s apart; for 6 of them the bare address, loaded twice meanwhile, was a
114
+ full page by its size, 2026-11-22). Queries not asked before (?a=1, ?a=2) gave the full
115
+ page every time (2026-11-18). "" off MDPI's article pages, or when the address has a query
116
+ already."""
112
117
  target = urlparse(page_url or "")
113
118
  if (target.scheme != "https" or (target.hostname or "").lower() not in {"www.mdpi.com", "mdpi.com"}
114
119
  or target.query or not _ARTICLE_PATH.fullmatch(target.path)):
115
120
  return ""
116
- return target._replace(query="type=check_update&version=1", fragment="").geturl()
121
+ return target._replace(query=f"type=check_update&version=1&t={time.time_ns() // 1_000_000}", fragment="").geturl()
117
122
 
118
123
  @classmethod
119
124
  def profile_pdf_candidates(cls, doi: str, source_url: str) -> list[str]:
@@ -7,10 +7,13 @@ from ..platforms.atypon import CURRENT_TEMPLATE_FULLTEXT_IMAGES_JS, CURRENT_TEMP
7
7
 
8
8
  @register
9
9
  class NeurologyAdapter(AtyponAdapter):
10
- """The AAN's Neurology journals on neurology.org."""
10
+ """The AAN's Neurology journals on neurology.org, and CONTINUUM on continuum.aan.com: the same
11
+ Atypon site type, its DOIs 10.1212/cont.* (its access box "GET ACCESS"; without its host here the
12
+ platform's institution login was never opened and the wait ran out on the article,
13
+ 10.1212/cont.0000000000001619, Windows 2026-11-23)."""
11
14
 
12
15
  publisher = "neurology"
13
- site_hosts = frozenset({"neurology.org", "www.neurology.org"})
16
+ site_hosts = frozenset({"neurology.org", "www.neurology.org", "continuum.aan.com"})
14
17
 
15
18
  # --fulltext: Atypon's current template (platforms/atypon), verified 2026-11-14.
16
19
  fulltext_shown_js = CURRENT_TEMPLATE_FULLTEXT_SHOWN_JS
@@ -13,7 +13,7 @@ from typing import Any
13
13
  from urllib.parse import parse_qs, urlencode, urljoin, urlparse
14
14
 
15
15
  from ...engine.batch_common import open_page, pump_until
16
- from ...engine.fulltext_page import MATHJAX_SOURCES_JS
16
+ from ...engine.fulltext_page import MATHJAX_SOURCES_JS, paragraph_text_js
17
17
  from ..base import PublisherAdapter, register
18
18
 
19
19
  # --fulltext (PaperSearch's sites/templates/optica.ts). The article page (abstract.cfm, as
@@ -23,14 +23,7 @@ from ..base import PublisherAdapter, register
23
23
  # (viewmedia.cfm ...&imagetype=full) is the full-size image, taken as the converter does; the
24
24
  # general sample rules had the loader (Optics Letters, a page saved after a school login,
25
25
  # 2026-11-15).
26
- FULLTEXT_SHOWN_JS = """() => {
27
- const body = document.querySelector('div#articleBody > article');
28
- if (!body) return false;
29
- const text = [...body.querySelectorAll('p')]
30
- .filter((p) => !p.closest('.back, .figure-image, .text-plus-thumb'))
31
- .reduce((total, p) => total + (p.textContent || '').length, 0);
32
- return text > 500;
33
- }"""
26
+ FULLTEXT_SHOWN_JS = paragraph_text_js("p", ".back, .figure-image, .text-plus-thumb", "> 500", root="div#articleBody > article")
34
27
  FULLTEXT_IMAGES_JS = """() => [...document.querySelectorAll('div#articleBody div.figure-image')].map((figure) => {
35
28
  const full = [...figure.querySelectorAll('a[href]')].find((a) => /[?&]imagetype=full(?:&|$)/i.test(a.getAttribute('href') || ''));
36
29
  if (full) return full.getAttribute('href');
@@ -75,13 +75,15 @@ class OUPAdapter(PublisherAdapter):
75
75
  if not doi:
76
76
  return True
77
77
  # <prefix>/<journal>/<id>: Oxford's own 10.1093 and the journals it hosts for
78
- # others under their prefixes (Karger's 10.1159/ned/…, 2026-11-14).
78
+ # others under their prefixes (Karger's 10.1159/ned/…, 2026-11-14). The PDF is named
79
+ # by <id>, under the site's own journal path, which is not always the DOI's journal code
80
+ # (Sexual Medicine Open Access: 10.1093/sexmed/qfaf103 at /smoa/, an open article with no
81
+ # PDF tried, Windows 2026-11-23; 89 of 451 journals in acceptance/catalog/oup.csv, e.g.
82
+ # Neuro-Oncology's neuonc at /neuro-oncology/). The PDF's first page is checked after.
79
83
  parts = doi.lower().split("/", 2)
80
84
  if len(parts) != 3:
81
85
  return False
82
- return (f"/doi/{doi.lower()}/" in path
83
- or (path.startswith(f"/{parts[1]}/article-pdf/")
84
- and path.rsplit("/", 1)[-1] == parts[2] + ".pdf"))
86
+ return f"/doi/{doi.lower()}/" in path or path.rsplit("/", 1)[-1] == parts[2] + ".pdf"
85
87
 
86
88
  def is_institution_chooser(self, url: str) -> bool:
87
89
  host = (urlparse(url or "").hostname or "").lower()
@@ -149,6 +151,7 @@ class OUPAdapter(PublisherAdapter):
149
151
  d._raise_on_publisher_content_error(page)
150
152
  if not d._wait_for_challenge(page, result, deadline=time.time() + max(0, opened_by - time.monotonic())):
151
153
  return False
154
+ d._note_article_host(page) # the site the article opened on, as the engine's own flow keeps it
152
155
  d._raise_on_publisher_content_error(page)
153
156
  d._dismiss_cookie_banners(page, result)
154
157
  if d._institution_pdf_entitlement_missing(page):
@@ -1,5 +1,8 @@
1
1
  """Website platforms: the shared rules of one website system that several
2
2
  publishers run on (Atypon, Silverchair). A platform is not a publisher: each
3
3
  publisher keeps its own folder in ``adapters/`` and inherits its platform's
4
- adapter there, adding only what is its own (docs/adr/0014).
4
+ adapter there, adding only what is its own (docs/adr/0014). A platform whose
5
+ publishers have no profile (J-STAGE's societies) registers its adapter for the
6
+ profile the engine builds for the site at run time (``site:<domain>``), on its
7
+ own hosts only.
5
8
  """
@@ -38,9 +38,13 @@ _SSOSTART_LINKS_JS = """() => [...document.querySelectorAll('a[href*="/action/ss
38
38
  # (Science, NEJM and PNAS, pages saved after a school login, 2026-11-14). A publisher on
39
39
  # this template names these once one of its pages is verified; Atypon's older template
40
40
  # (Taylor & Francis: hlFld-Fulltext) has neither: its rules are CLASSIC_TEMPLATE_* below.
41
+ # A table's figure that holds the table itself gives no image: NEJM's figure.table has the
42
+ # table and a picture of it, the Markdown writes the table, and the picture was counted as
43
+ # a figure left out ("图片可能不全" on 6 NEJM pages, 2026-11-25).
41
44
  CURRENT_TEMPLATE_FULLTEXT_SHOWN_JS = """() => (document.querySelector('section#bodymatter')?.innerText.length || 0) > 500
42
45
  && !document.querySelector('.denial-block')"""
43
46
  CURRENT_TEMPLATE_FULLTEXT_IMAGES_JS = r"""() => [...document.querySelectorAll('figure img[data-open="viewer"], section#bodymatter figure img')]
47
+ .filter((img) => !img.closest('figure')?.querySelector('table'))
44
48
  .map((img) => img.currentSrc || img.src)
45
49
  .filter((url) => /\/assets\/images\//.test(url))
46
50
  .map((url) => url.replace(/\/assets\/images\/(?:small|medium)\//, '/assets/images/large/'))"""
@@ -115,6 +119,10 @@ class AtyponAdapter(PublisherAdapter):
115
119
 
116
120
  site_hosts: frozenset[str] = frozenset()
117
121
  entry_event = "atypon-institution-link"
122
+ # Without access the PDF address (/doi/pdf/<DOI>) answers with the article's own page there: Taylor & Francis
123
+ # (Scand J Rheumatol 2013, 10.3109, signed in, "Purchase options" on it) and NEJM Catalyst (10.1056/cat.24.0478,
124
+ # "Welcome: <school>" and "Get Access" on it), each ended as pdf_not_captured (Windows, 2026-11-22 and -23).
125
+ pdf_address_shows_article_page = True
118
126
 
119
127
  def _on_site(self, url: str) -> bool:
120
128
  parsed = urlparse(url or "")
@@ -0,0 +1,64 @@
1
+ """J-STAGE (www.jstage.jst.go.jp): the Japan Science and Technology Agency's platform that
2
+ hundreds of Japanese societies publish their journals on, each under its own DOI prefix.
3
+
4
+ No publisher profile names these societies: their articles are downloaded with the shared
5
+ rules, under the profile the engine builds for the site at run time
6
+ (``publishers/site.py``: ``site:jst.go.jp``, J-STAGE's registrable domain). This platform's
7
+ rules are registered by that name, so that a society without a profile of its own still has
8
+ them; they are chosen on J-STAGE's own host only (``hosts``): the run-time profile's domain is
9
+ all of JST's sites. A society given a profile of its own later inherits this adapter. Only the
10
+ full-text page is J-STAGE's here; the login and the PDF stay the shared rules'.
11
+
12
+ --fulltext (PaperSearch Pro's sites/platforms/jstage.ts). The download opens the article's
13
+ abstract page (``/article/<journal>/<volume>/<issue>/<code>/_article``, ``…/_article/-char/ja/``);
14
+ the full text, where the journal gives one in HTML, is the "Full Text HTML" page
15
+ (``…/_html/-char/en``), read in a tab of its own (``fulltext_page_url``). Most articles have
16
+ their PDF alone: that address answers 404, and the page read ends there. On the full-text page
17
+ the body is ``#article-overiew-abstract-wrap`` (sic) of ``div#abstract`` and one
18
+ ``div#sec<NN>`` per section (inside ``div.fullHtmlNonDisp``); a figure is
19
+ ``div.global-image-holder`` with its image (``./Graphics/<name>``, the largest the site has:
20
+ its "Figures" panel shows the same file). MathJax 2 typesets the formulas; their MathML is kept
21
+ before saving (Environmental Health and Preventive Medicine, Journal of Atherosclerosis and
22
+ Thrombosis, 2026-11-23).
23
+ """
24
+ from __future__ import annotations
25
+
26
+ import re
27
+ from urllib.parse import urlparse
28
+
29
+ from ....engine.fulltext_page import MATHJAX_SOURCES_JS, paragraph_text_js
30
+ from ....publishers.site import SITE_PREFIX
31
+ from ...base import PublisherAdapter, register
32
+
33
+ _HOSTS = frozenset({"www.jstage.jst.go.jp", "jstage.jst.go.jp"})
34
+ # An article's abstract page, with the language it is shown in when the address names one.
35
+ _ABSTRACT_PAGE = re.compile(r"(/article/(?:[^/]+/){4})_article(?:/-char/([a-z]{2}))?/?")
36
+
37
+ FULLTEXT_SHOWN_JS = paragraph_text_js('#article-overiew-abstract-wrap > div[id^="sec"] p',
38
+ ".global-image-holder, .responsive-table-wrap, .fj-list-ref", ">= 200")
39
+ FULLTEXT_IMAGES_JS = r"""() => [...document.querySelectorAll('#article-overiew-abstract-wrap > div[id^="sec"] div.global-image-holder img')]
40
+ .map((img) => {
41
+ const src = img.getAttribute('src') || img.getAttribute('data-src') || '';
42
+ try { return src ? new URL(src, location.href).href : ''; } catch (error) { return ''; }
43
+ })
44
+ .filter((url) => /^https?:/.test(url))"""
45
+
46
+
47
+ @register
48
+ class JStageAdapter(PublisherAdapter):
49
+ publisher = SITE_PREFIX + "jst.go.jp"
50
+ hosts = ("jstage.jst.go.jp",)
51
+ fulltext_shown_js = FULLTEXT_SHOWN_JS
52
+ fulltext_images_js = FULLTEXT_IMAGES_JS
53
+ fulltext_prepare_js = MATHJAX_SOURCES_JS
54
+
55
+ def fulltext_page_url(self, doi: str, page_url: str) -> str:
56
+ """The article's "Full Text HTML" page beside its abstract page (``…/_article`` →
57
+ ``…/_html/-char/en``, in the language the abstract page was shown in); "" on any
58
+ other page, the full-text page itself included."""
59
+ target = urlparse(page_url or "")
60
+ host = (target.hostname or "").lower()
61
+ found = _ABSTRACT_PAGE.fullmatch(target.path)
62
+ if target.scheme != "https" or host not in _HOSTS or not found:
63
+ return ""
64
+ return f"https://{host}{found.group(1)}_html/-char/{found.group(2) or 'en'}"
@@ -33,9 +33,6 @@ class TaylorFrancisAdapter(AtyponAdapter):
33
33
  entry_event = "tandf-institution-link"
34
34
  # A viewer's first range can start with %PDF yet contain no usable pages.
35
35
  requires_complete_pdf = True
36
- # Scand J Rheumatol 2013 (10.3109), Windows 2026-11-22: signed in, the PDF address answered with the article's
37
- # page, "Purchase options" on it, and the item ended as pdf_not_captured.
38
- pdf_address_shows_article_page = True
39
36
 
40
37
  # --fulltext: Atypon's older template (platforms/atypon).
41
38
  fulltext_shown_js = CLASSIC_TEMPLATE_FULLTEXT_SHOWN_JS
@@ -17,7 +17,7 @@ import time
17
17
  from typing import Any
18
18
  from urllib.parse import parse_qs, unquote, urlencode, urljoin, urlparse
19
19
 
20
- from ...engine.fulltext_page import MATHJAX_SOURCES_JS
20
+ from ...engine.fulltext_page import MATHJAX_SOURCES_JS, paragraph_text_js
21
21
  from ...engine.router import is_thieme_article_pdf_url
22
22
  from ...engine.batch_common import _is_browser_error, open_page
23
23
  from ..base import PublisherAdapter, SupplementLink, register
@@ -35,14 +35,7 @@ _SUPPLEMENT_ROWS_JS = """() => [...document.querySelectorAll('a[href]')].map(a =
35
35
  # one is taken, as the converter does; the general sample rules had the thumbnails. The
36
36
  # references are in the page (Endoscopy International Open, pages saved after a school
37
37
  # login, 2026-11-14).
38
- FULLTEXT_SHOWN_JS = """() => {
39
- const body = document.querySelector('#sections > section#htmlfulltext');
40
- if (!body) return false;
41
- const text = [...body.querySelectorAll('p')]
42
- .filter((p) => !p.closest('ul.literaturliste, .articleBox'))
43
- .reduce((total, p) => total + (p.textContent || '').length, 0);
44
- return text > 500;
45
- }"""
38
+ FULLTEXT_SHOWN_JS = paragraph_text_js("p", "ul.literaturliste, .articleBox", "> 500", root="#sections > section#htmlfulltext")
46
39
  FULLTEXT_IMAGES_JS = """() => {
47
40
  const body = document.querySelector('#sections > section#htmlfulltext');
48
41
  if (!body) return [];