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.
Files changed (204) hide show
  1. package/NOTICE +8 -37
  2. package/README.fr.md +265 -0
  3. package/README.ja.md +265 -0
  4. package/README.ko.md +265 -0
  5. package/README.md +149 -148
  6. package/README.zh-Hant.md +265 -0
  7. package/README.zh.md +265 -0
  8. package/dist/capabilities/download/batch/batch.d.ts +20 -1
  9. package/dist/capabilities/download/batch/batch.d.ts.map +1 -1
  10. package/dist/capabilities/download/batch/batch.js +1057 -208
  11. package/dist/capabilities/download/batch/batch.js.map +1 -1
  12. package/dist/capabilities/download/batch/batchFolder.d.ts.map +1 -1
  13. package/dist/capabilities/download/batch/batchFolder.js +3 -2
  14. package/dist/capabilities/download/batch/batchFolder.js.map +1 -1
  15. package/dist/capabilities/download/batch/networkLoss.d.ts +11 -2
  16. package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -1
  17. package/dist/capabilities/download/batch/networkLoss.js +24 -3
  18. package/dist/capabilities/download/batch/networkLoss.js.map +1 -1
  19. package/dist/capabilities/download/batch/resume.d.ts +7 -0
  20. package/dist/capabilities/download/batch/resume.d.ts.map +1 -1
  21. package/dist/capabilities/download/batch/resume.js +50 -9
  22. package/dist/capabilities/download/batch/resume.js.map +1 -1
  23. package/dist/capabilities/download/batch/windowPlan.d.ts +96 -0
  24. package/dist/capabilities/download/batch/windowPlan.d.ts.map +1 -0
  25. package/dist/capabilities/download/batch/windowPlan.js +196 -0
  26. package/dist/capabilities/download/batch/windowPlan.js.map +1 -0
  27. package/dist/capabilities/download/content/markdown/pro.d.ts +6 -0
  28. package/dist/capabilities/download/content/markdown/pro.d.ts.map +1 -1
  29. package/dist/capabilities/download/content/markdown/pro.js.map +1 -1
  30. package/dist/capabilities/download/content/markdown/shortfall.d.ts +8 -5
  31. package/dist/capabilities/download/content/markdown/shortfall.d.ts.map +1 -1
  32. package/dist/capabilities/download/content/markdown/shortfall.js +22 -10
  33. package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -1
  34. package/dist/capabilities/download/content/markdown/step.d.ts +9 -0
  35. package/dist/capabilities/download/content/markdown/step.d.ts.map +1 -1
  36. package/dist/capabilities/download/content/markdown/step.js +46 -3
  37. package/dist/capabilities/download/content/markdown/step.js.map +1 -1
  38. package/dist/capabilities/download/content/markdown/types.d.ts +10 -1
  39. package/dist/capabilities/download/content/markdown/types.d.ts.map +1 -1
  40. package/dist/capabilities/download/content/pdf/open/tiers/scihub.d.ts.map +1 -1
  41. package/dist/capabilities/download/content/pdf/open/tiers/scihub.js +3 -1
  42. package/dist/capabilities/download/content/pdf/open/tiers/scihub.js.map +1 -1
  43. package/dist/capabilities/download/handler.d.ts.map +1 -1
  44. package/dist/capabilities/download/handler.js +13 -5
  45. package/dist/capabilities/download/handler.js.map +1 -1
  46. package/dist/capabilities/download/outputLayout.d.ts.map +1 -1
  47. package/dist/capabilities/download/outputLayout.js +3 -1
  48. package/dist/capabilities/download/outputLayout.js.map +1 -1
  49. package/dist/capabilities/download/tools.js +2 -2
  50. package/dist/capabilities/download/tools.js.map +1 -1
  51. package/dist/capabilities/download/types.d.ts +9 -1
  52. package/dist/capabilities/download/types.d.ts.map +1 -1
  53. package/dist/cli.js +3 -1
  54. package/dist/cli.js.map +1 -1
  55. package/dist/infrastructure/http/hostGate.d.ts +24 -0
  56. package/dist/infrastructure/http/hostGate.d.ts.map +1 -0
  57. package/dist/infrastructure/http/hostGate.js +72 -0
  58. package/dist/infrastructure/http/hostGate.js.map +1 -0
  59. package/dist/infrastructure/pdf/PdfDownload.d.ts +1 -0
  60. package/dist/infrastructure/pdf/PdfDownload.d.ts.map +1 -1
  61. package/dist/infrastructure/pdf/PdfDownload.js +6 -1
  62. package/dist/infrastructure/pdf/PdfDownload.js.map +1 -1
  63. package/dist/infrastructure/runlog/RunLedger.d.ts +14 -0
  64. package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
  65. package/dist/infrastructure/runlog/RunLedger.js +30 -4
  66. package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
  67. package/dist/infrastructure/runlog/failureClass.d.ts +2 -1
  68. package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
  69. package/dist/infrastructure/runlog/failureClass.js +27 -4
  70. package/dist/infrastructure/runlog/failureClass.js.map +1 -1
  71. package/dist/infrastructure/school/SchoolAttempt.d.ts +11 -0
  72. package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -1
  73. package/dist/infrastructure/school/SchoolAttempt.js +48 -5
  74. package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
  75. package/dist/infrastructure/school/SchoolMcpClient.d.ts +13 -2
  76. package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
  77. package/dist/infrastructure/school/SchoolMcpClient.js +138 -15
  78. package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -1
  79. package/dist/infrastructure/school/SchoolProgress.d.ts +2 -0
  80. package/dist/infrastructure/school/SchoolProgress.d.ts.map +1 -1
  81. package/dist/infrastructure/school/SchoolProgress.js +2 -0
  82. package/dist/infrastructure/school/SchoolProgress.js.map +1 -1
  83. package/dist/infrastructure/school/SchoolReadiness.d.ts +9 -0
  84. package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -1
  85. package/dist/infrastructure/school/SchoolReadiness.js +10 -0
  86. package/dist/infrastructure/school/SchoolReadiness.js.map +1 -1
  87. package/dist/infrastructure/school/SchoolResultNormalizer.d.ts.map +1 -1
  88. package/dist/infrastructure/school/SchoolResultNormalizer.js +4 -0
  89. package/dist/infrastructure/school/SchoolResultNormalizer.js.map +1 -1
  90. package/dist/infrastructure/school/index.d.ts +2 -2
  91. package/dist/infrastructure/school/index.d.ts.map +1 -1
  92. package/dist/infrastructure/school/index.js +1 -1
  93. package/dist/infrastructure/school/index.js.map +1 -1
  94. package/dist/infrastructure/school/types.d.ts +73 -1
  95. package/dist/infrastructure/school/types.d.ts.map +1 -1
  96. package/dist/infrastructure/school/types.js.map +1 -1
  97. package/dist/infrastructure/security/SecurityUtils.d.ts.map +1 -1
  98. package/dist/infrastructure/security/SecurityUtils.js +6 -2
  99. package/dist/infrastructure/security/SecurityUtils.js.map +1 -1
  100. package/dist/management/failures/index.d.ts +23 -0
  101. package/dist/management/failures/index.d.ts.map +1 -1
  102. package/dist/management/failures/index.js +68 -20
  103. package/dist/management/failures/index.js.map +1 -1
  104. package/dist/management/school/autoUpdate.d.ts.map +1 -1
  105. package/dist/management/school/autoUpdate.js +9 -1
  106. package/dist/management/school/autoUpdate.js.map +1 -1
  107. package/dist/management/school/cliProgress.d.ts.map +1 -1
  108. package/dist/management/school/cliProgress.js +3 -1
  109. package/dist/management/school/cliProgress.js.map +1 -1
  110. package/package.json +8 -3
  111. package/school/NOTICE +3 -2
  112. package/school/paper_search_school/adapters/__init__.py +2 -0
  113. package/school/paper_search_school/adapters/aps/__init__.py +3 -6
  114. package/school/paper_search_school/adapters/base.py +19 -2
  115. package/school/paper_search_school/adapters/copernicus/__init__.py +2 -7
  116. package/school/paper_search_school/adapters/elsevier/__init__.py +50 -1
  117. package/school/paper_search_school/adapters/frontiers/__init__.py +41 -2
  118. package/school/paper_search_school/adapters/ieee/__init__.py +6 -4
  119. package/school/paper_search_school/adapters/iop/__init__.py +8 -0
  120. package/school/paper_search_school/adapters/jama/__init__.py +8 -0
  121. package/school/paper_search_school/adapters/lww/__init__.py +14 -6
  122. package/school/paper_search_school/adapters/mdpi/__init__.py +12 -7
  123. package/school/paper_search_school/adapters/neurology/__init__.py +5 -2
  124. package/school/paper_search_school/adapters/optica/__init__.py +52 -13
  125. package/school/paper_search_school/adapters/oup/__init__.py +7 -4
  126. package/school/paper_search_school/adapters/platforms/__init__.py +4 -1
  127. package/school/paper_search_school/adapters/platforms/atypon/__init__.py +12 -3
  128. package/school/paper_search_school/adapters/platforms/figshare/__init__.py +23 -4
  129. package/school/paper_search_school/adapters/platforms/jstage/__init__.py +64 -0
  130. package/school/paper_search_school/adapters/taylor_francis/__init__.py +0 -3
  131. package/school/paper_search_school/adapters/thieme/__init__.py +2 -9
  132. package/school/paper_search_school/api_keys.py +63 -13
  133. package/school/paper_search_school/assets/api_keys.json +14 -0
  134. package/school/paper_search_school/assets/capsule.html +526 -147
  135. package/school/paper_search_school/assets/capsule_en.json +140 -49
  136. package/school/paper_search_school/assets/capsule_fr.json +141 -50
  137. package/school/paper_search_school/assets/capsule_ja.json +140 -49
  138. package/school/paper_search_school/assets/capsule_ko.json +140 -49
  139. package/school/paper_search_school/assets/capsule_zh-Hant.json +134 -48
  140. package/school/paper_search_school/browser/backend.py +125 -4
  141. package/school/paper_search_school/browser/batch_session.py +189 -8
  142. package/school/paper_search_school/browser/challenge/__init__.py +12 -9
  143. package/school/paper_search_school/browser/challenge/continuation.py +83 -0
  144. package/school/paper_search_school/browser/challenge/handlers/__init__.py +1 -0
  145. package/school/paper_search_school/browser/challenge/handlers/aws_waf.py +260 -0
  146. package/school/paper_search_school/browser/challenge/handlers/recaptcha_hcaptcha.py +167 -0
  147. package/school/paper_search_school/browser/challenge/handlers/text_captcha.py +128 -0
  148. package/school/paper_search_school/browser/challenge/handlers/turnstile.py +174 -0
  149. package/school/paper_search_school/browser/challenge/kinds.py +203 -0
  150. package/school/paper_search_school/browser/challenge/local/__init__.py +1 -0
  151. package/school/paper_search_school/browser/challenge/{interaction.py → local/interaction.py} +94 -13
  152. package/school/paper_search_school/browser/challenge/{pointer.py → local/pointer.py} +2 -2
  153. package/school/paper_search_school/browser/challenge/local/prompt.py +283 -0
  154. package/school/paper_search_school/browser/challenge/local/submission.py +33 -0
  155. package/school/paper_search_school/browser/challenge/pro.py +24 -0
  156. package/school/paper_search_school/browser/challenge/services/__init__.py +1 -0
  157. package/school/paper_search_school/browser/challenge/services/solver.py +292 -0
  158. package/school/paper_search_school/browser/engine.py +4 -1
  159. package/school/paper_search_school/browser/user_turn.py +126 -0
  160. package/school/paper_search_school/browser/watchdog.py +213 -60
  161. package/school/paper_search_school/cli_config.py +10 -5
  162. package/school/paper_search_school/config.py +16 -10
  163. package/school/paper_search_school/download_diagnostics.py +7 -2
  164. package/school/paper_search_school/engine/access_rules.py +12 -3
  165. package/school/paper_search_school/engine/batch.py +52 -18
  166. package/school/paper_search_school/engine/batch_access.py +62 -16
  167. package/school/paper_search_school/engine/batch_capture.py +260 -31
  168. package/school/paper_search_school/engine/batch_common.py +3 -0
  169. package/school/paper_search_school/engine/batch_diagnostics.py +25 -5
  170. package/school/paper_search_school/engine/batch_institution.py +52 -3
  171. package/school/paper_search_school/engine/batch_login.py +398 -36
  172. package/school/paper_search_school/engine/batch_pdf_urls.py +38 -7
  173. package/school/paper_search_school/engine/batch_user.py +48 -3
  174. package/school/paper_search_school/engine/batch_waits.py +221 -14
  175. package/school/paper_search_school/engine/bridge.py +29 -6
  176. package/school/paper_search_school/engine/fulltext_page.py +55 -8
  177. package/school/paper_search_school/engine/router.py +16 -1
  178. package/school/paper_search_school/engine/supplements.py +7 -1
  179. package/school/paper_search_school/entitlements.py +29 -1
  180. package/school/paper_search_school/pdf_utils.py +25 -16
  181. package/school/paper_search_school/progress_capsule.py +69 -11
  182. package/school/paper_search_school/progress_reporter.py +243 -11
  183. package/school/paper_search_school/progress_view.py +205 -91
  184. package/school/paper_search_school/publishers/builtin/iop.json +2 -1
  185. package/school/paper_search_school/publishers/builtin/neurology.json +4 -2
  186. package/school/paper_search_school/publishers/site.py +12 -4
  187. package/school/paper_search_school/rate_limit.py +24 -1
  188. package/school/paper_search_school/school_login.py +170 -8
  189. package/school/paper_search_school/school_test.py +1 -1
  190. package/school/paper_search_school/server.py +179 -23
  191. package/school/paper_search_school/user_settings.py +46 -4
  192. package/school/pyproject.toml +1 -0
  193. package/skills/paper-search/SKILL.md +107 -107
  194. package/skills/paper-search/references/browser-download.md +102 -99
  195. package/skills/paper-search/references/capability-routing.md +89 -89
  196. package/skills/paper-search/references/cli-contract.md +78 -78
  197. package/skills/paper-search/references/federation-support.md +172 -172
  198. package/skills/paper-search/references/management-layer.md +78 -78
  199. package/skills/paper-search/references/publisher-support.md +38 -38
  200. package/skills/paper-search/references/school-setup.md +56 -55
  201. package/skills/paper-search/references/setup.md +20 -20
  202. package/skills/paper-search/references/troubleshooting.md +12 -12
  203. package/README.en.md +0 -264
  204. package/school/paper_search_school/browser/challenge/prompt.py +0 -154
@@ -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,8 +13,8 @@ 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
17
- from ..base import PublisherAdapter, register
16
+ from ...engine.fulltext_page import MATHJAX_SOURCES_JS, paragraph_text_js
17
+ from ..base import PublisherAdapter, SupplementLink, register
18
18
 
19
19
  # --fulltext (PaperSearch's sites/templates/optica.ts). The article page (abstract.cfm, as
20
20
  # fulltext.cfm) shows a reader with access the full text: div#articleBody holds the abstract
@@ -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');
@@ -39,6 +32,28 @@ FULLTEXT_IMAGES_JS = """() => [...document.querySelectorAll('div#articleBody div
39
32
  }).filter((src) => src && !src.startsWith('data:') && !/ajax-loader/i.test(src))
40
33
  .map((src) => new URL(src, location.href).href)"""
41
34
 
35
+ # The access box beside the abstract: div.access-permissions "inaccessible" ("Not Accessible / Your
36
+ # library or personal account may give you access"), "accessible" (a subscriber, after a school
37
+ # login) or "open". Not accessible, the page is the abstract alone (no <article> in div#articleBody):
38
+ # the read said so after waiting 15 s for a body (Applied Optics, a page saved before any login,
39
+ # 2026-11-18; "accessible" or "open" on 18 pages read after a login or open, 2026-11-26).
40
+ FULLTEXT_WITHHELD_JS = """() => {
41
+ const box = document.querySelector('div.access-permissions.inaccessible');
42
+ return box && !document.querySelector('div#articleBody > article') ? (box.textContent || '').replace(/\\s+/g, ' ').trim() : '';
43
+ }"""
44
+
45
+ # Its supplementary material: the article page with its full text lists it in div#articleSupplMat
46
+ # ("Supplementary Material (1)", a table of a.view_media rows: "Supplement 1", "Visualization 1",
47
+ # viewmedia.cfm?...&seq=s001 / v001), the sidebar saying "Suppl. Mat. (1)"; the files are on
48
+ # Figshare, linked from the body as doi.org/10.6084/m9.figshare.<id> under the same name. An article
49
+ # without any has neither (18 pages after a login or open, 2026-11-26: 4 with one, 14 with none). The
50
+ # abstract alone (not accessible) lists none of it either way: it says nothing then.
51
+ _SUPPLEMENT_LISTING_JS = """() => ({
52
+ doi: document.querySelector('meta[name="citation_doi"]')?.content || '',
53
+ full: !!document.querySelector('div#articleBody > article') && !!document.querySelector('a.sidebar-nav-link'),
54
+ rows: [...document.querySelectorAll('#articleSupplMat a.view_media')].map((a) => (a.textContent || '').replace(/\\s+/g, ' ').trim()),
55
+ })"""
56
+
42
57
 
43
58
  # Back on Optica after the school's login, its home page saying the organisation the login named
44
59
  # has no access through SSO (a CARSI school through the OpenAthens chooser, 2026-11-18): the login
@@ -60,8 +75,23 @@ class OpticaAdapter(PublisherAdapter):
60
75
  # output (data-latex), which the shared script leaves alone; it keeps a MathML one's
61
76
  # source and waits for the first typesetting.
62
77
  fulltext_prepare_js = MATHJAX_SOURCES_JS
63
-
64
- def supplement_links(self, page: Any, doi: str) -> None:
78
+ fulltext_withheld_js = FULLTEXT_WITHHELD_JS
79
+
80
+ def is_redirect_page(self, url: str) -> bool:
81
+ """The HTML reader a DOI opens (viewmedia.cfm?…&html=true): it moves on by script to the
82
+ article (fulltext.cfm, abstract.cfm) or to Optica's text verification. The access check
83
+ ended on it before it moved, and the verification it then showed was left alone: the
84
+ page read waited 23 s on it, the PDF step ran out of time (Optics Express, Windows
85
+ 2026-11-26). Throttled, Optica shows its message at this same address (the wait stops)."""
86
+ target = urlparse(url or "")
87
+ return (target.scheme == "https" and (target.hostname or "").lower() == "opg.optica.org"
88
+ and target.path.lower().endswith("/viewmedia.cfm")
89
+ and parse_qs(target.query).get("html") == ["true"])
90
+
91
+ def supplement_links(self, page: Any, doi: str) -> list[SupplementLink] | None:
92
+ """[] when this article's page with its full text lists no supplementary material; None
93
+ otherwise: its files are on Figshare, which the shared rule reads (the names this page
94
+ lists count as this article's there), or the page cannot say."""
65
95
  # The embedded reader can still be loading after the outer document
66
96
  # reports ready. Let its article metadata/links render before discovery.
67
97
  target = urlparse(str(page.url))
@@ -72,7 +102,16 @@ class OpticaAdapter(PublisherAdapter):
72
102
  (!!document.querySelector('meta[name="citation_doi"]')
73
103
  || document.querySelectorAll('a[href]').length > 0)
74
104
  """), 15_000)
75
- return None
105
+ return self.listed_supplement_links(page, doi)
106
+
107
+ def listed_supplement_links(self, page: Any, doi: str) -> list[SupplementLink] | None:
108
+ """Read before the PDF, on the page as it is: [] when it lists none, so the attachment step
109
+ loads no page (8 to 27 s an article, Windows 2026-11-26); None when it lists some or cannot say."""
110
+ listing = page.evaluate(_SUPPLEMENT_LISTING_JS)
111
+ if (not isinstance(listing, dict) or not listing.get("full")
112
+ or str(listing.get("doi") or "").strip().lower() != (doi or "").strip().lower()):
113
+ return None
114
+ return None if listing.get("rows") else []
76
115
 
77
116
  @classmethod
78
117
  def profile_pdf_candidates(cls, doi: str, source_url: str) -> list[str]:
@@ -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 "")
@@ -154,9 +162,10 @@ class AtyponAdapter(PublisherAdapter):
154
162
  open_page(page, landing, timeout_ms=30_000)
155
163
  return []
156
164
 
157
- def listed_supplement_links(self, page: Any, doi: str) -> list[SupplementLink]:
158
- """The files this page lists itself, read without leaving it."""
159
- return self._listed_supplements(page, doi)[0]
165
+ def listed_supplement_links(self, page: Any, doi: str) -> list[SupplementLink] | None:
166
+ """The files this page lists itself, read without leaving it; None without any (a
167
+ landing page of them, or none at all: this page cannot say)."""
168
+ return self._listed_supplements(page, doi)[0] or None
160
169
 
161
170
  def _listed_supplements(self, page: Any, doi: str) -> tuple[list[SupplementLink], str]:
162
171
  """``(files, landing page)`` linked from this page for this article."""
@@ -23,12 +23,22 @@ _PAGE_LINKS = """() => {
23
23
  const links = [...document.querySelectorAll('a[href], iframe[src]')]
24
24
  .filter(a => !a.closest('[role="doc-bibliography"], [role="doc-biblioentry"], '
25
25
  + '#references, #bibliography, #articleReferences, .ref-list, .article-section__references'));
26
+ const said = (node) => (node.textContent || '').replace(/\\s+/g,' ').trim();
27
+ // The names the page's own list of its supplementary material gives, a part of its own under a
28
+ // "Supplementary Material" heading (Optica's table: "Supplement 1", "Visualization 1", 2026-11-26).
29
+ const listed = new Set();
30
+ for (const heading of document.querySelectorAll('h2, h3, h4')) {
31
+ const part = heading.parentElement;
32
+ if (part && /^supplementary materials?\\b/i.test(said(heading)) && part.querySelectorAll('h1, h2, h3, h4').length === 1) {
33
+ part.querySelectorAll('a').forEach(a => said(a) && listed.add(said(a).toLowerCase()));
34
+ }
35
+ }
26
36
  return {
27
37
  doi: document.querySelector('meta[name="citation_doi"]')?.content || '',
28
38
  links: links.map(a => a.href || a.src),
29
39
  labelled: links.filter(a => a.tagName === 'A' &&
30
- /^(?:supplement(?:ary)?(?: (?:material|information|data|file|document))?|supporting information)\\s*\\d*$/i
31
- .test((a.textContent || '').replace(/\\s+/g,' ').trim())).map(a => a.href)
40
+ (/^(?:supplement(?:ary)?(?: (?:material|information|data|file|document))?|supporting information)\\s*\\d*$/i
41
+ .test(said(a)) || listed.has(said(a).toLowerCase()))).map(a => a.href)
32
42
  };
33
43
  }"""
34
44
 
@@ -78,11 +88,20 @@ def _belongs(data: dict, doi: str, *, labelled: bool = False) -> bool:
78
88
  if isinstance(item, dict) and item.get("relation") == "IsSupplementTo"]
79
89
  if parents:
80
90
  return doi in parents
81
- # Some publisher deposits omit the backlink. An explicit Supplement link
82
- # on the DOI-verified article is then sufficient; a plain citation is not.
91
+ # Some publisher deposits omit the backlink (Optica's, all of them). An explicit Supplement
92
+ # link on the DOI-verified article, or one under a name its own supplementary list gives
93
+ # ("Visualization 1", a video), is then sufficient; a plain citation is not.
83
94
  return labelled
84
95
 
85
96
 
97
+ def resources_linked(page: Any) -> bool:
98
+ """Whether the page links a Figshare article or collection outside its references (a link to
99
+ Figshare's own pages, as Optica's menu has to its preprints, is none)."""
100
+ data = page.evaluate(_PAGE_LINKS)
101
+ links = data.get("links") if isinstance(data, dict) else None
102
+ return any(isinstance(url, str) and resource(url) for url in links or ())
103
+
104
+
86
105
  def supplement_links(page: Any, doi: str, *, clock=time.monotonic, pause=time.sleep) -> list[SupplementLink] | None:
87
106
  """None means no Figshare route on this article; failures stay in the manifest.
88
107
  A resource not shown to be this article's is set aside (``set_aside``)."""
@@ -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 [];