papersearch 0.7.2 → 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.
- package/LICENSE-paper-search-mcp-nodejs +24 -0
- package/NOTICE +8 -37
- package/README.en.md +7 -3
- package/README.fr.md +268 -0
- package/README.ja.md +268 -0
- package/README.ko.md +268 -0
- package/README.md +7 -3
- package/README.zh-Hant.md +268 -0
- package/dist/capabilities/download/batch/batch.d.ts +16 -1
- package/dist/capabilities/download/batch/batch.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batch.js +669 -53
- 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 +4 -3
- package/dist/capabilities/download/batch/batchFolder.js.map +1 -1
- package/dist/capabilities/download/batch/batchSummary.js +1 -1
- package/dist/capabilities/download/batch/batchSummary.js.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.d.ts +12 -3
- package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.js +25 -4
- 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/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 +27 -15
- 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 +42 -2
- 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/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/runlog/RunLedger.d.ts +7 -0
- package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.js +13 -0
- package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts +17 -9
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +89 -56
- 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 +107 -59
- package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.d.ts +7 -2
- package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.js +30 -7
- 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 +2 -0
- package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.js +2 -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 +52 -3
- package/dist/infrastructure/school/types.d.ts.map +1 -1
- package/dist/infrastructure/school/types.js.map +1 -1
- package/dist/management/failures/index.d.ts +28 -2
- package/dist/management/failures/index.d.ts.map +1 -1
- package/dist/management/failures/index.js +83 -21
- package/dist/management/failures/index.js.map +1 -1
- package/package.json +7 -2
- 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 +18 -0
- 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 +2 -9
- package/school/paper_search_school/adapters/oup/__init__.py +27 -4
- package/school/paper_search_school/adapters/platforms/__init__.py +4 -1
- package/school/paper_search_school/adapters/platforms/atypon/__init__.py +8 -0
- package/school/paper_search_school/adapters/platforms/jstage/__init__.py +64 -0
- package/school/paper_search_school/adapters/sage/__init__.py +4 -1
- package/school/paper_search_school/adapters/thieme/__init__.py +6 -11
- 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 +274 -158
- package/school/paper_search_school/assets/capsule_en.json +99 -98
- package/school/paper_search_school/assets/capsule_fr.json +100 -99
- package/school/paper_search_school/assets/capsule_ja.json +99 -98
- package/school/paper_search_school/assets/capsule_ko.json +99 -98
- package/school/paper_search_school/assets/capsule_zh-Hant.json +94 -97
- package/school/paper_search_school/browser/batch_session.py +1 -1
- package/school/paper_search_school/browser/challenge/__init__.py +12 -9
- package/school/paper_search_school/browser/challenge/continuation.py +65 -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 +100 -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/services/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/services/solver.py +272 -0
- package/school/paper_search_school/cli_config.py +10 -5
- package/school/paper_search_school/cold_start.py +22 -11
- package/school/paper_search_school/config.py +11 -10
- package/school/paper_search_school/download_diagnostics.py +7 -2
- package/school/paper_search_school/engine/access_rules.py +15 -5
- package/school/paper_search_school/engine/batch.py +55 -15
- package/school/paper_search_school/engine/batch_access.py +59 -21
- package/school/paper_search_school/engine/batch_capture.py +215 -18
- 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 +168 -32
- package/school/paper_search_school/engine/batch_login.py +223 -16
- package/school/paper_search_school/engine/batch_pdf_urls.py +38 -7
- package/school/paper_search_school/engine/batch_waits.py +179 -12
- package/school/paper_search_school/engine/bridge.py +44 -7
- package/school/paper_search_school/engine/fulltext_page.py +45 -7
- package/school/paper_search_school/engine/router.py +18 -2
- package/school/paper_search_school/entitlements.py +1 -1
- package/school/paper_search_school/orchestrator.py +44 -18
- package/school/paper_search_school/pdf_utils.py +25 -16
- package/school/paper_search_school/progress_capsule.py +36 -6
- package/school/paper_search_school/progress_reporter.py +71 -13
- package/school/paper_search_school/progress_view.py +64 -44
- 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/builtin/sage.json +4 -2
- package/school/paper_search_school/publishers/builtin/thieme.json +3 -1
- package/school/paper_search_school/publishers/site.py +12 -4
- package/school/paper_search_school/school_switch.py +34 -52
- package/school/paper_search_school/school_test.py +1 -1
- package/school/paper_search_school/server.py +24 -11
- package/school/paper_search_school/user_settings.py +13 -0
- package/school/pyproject.toml +1 -0
- package/skills/paper-search/SKILL.md +107 -107
- package/skills/paper-search/references/browser-download.md +102 -101
- 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/school/paper_search_school/browser/challenge/prompt.py +0 -154
|
@@ -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
|
-
|
|
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
|
|
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() +
|
|
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 (
|
|
4
|
-
|
|
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
|
-
#
|
|
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
|
-
|
|
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"
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
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):
|
|
@@ -406,3 +409,23 @@ class OUPAdapter(PublisherAdapter):
|
|
|
406
409
|
result.reason = "login_timeout"
|
|
407
410
|
d._event(result, "login_stopped", result.reason)
|
|
408
411
|
return False
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
@register
|
|
415
|
+
class OUPKeptDoiAdapter(OUPAdapter):
|
|
416
|
+
"""Journals Oxford Academic took over with their DOIs kept, which name no journal (Wiley's 10.1002/jbmr.4720 and
|
|
417
|
+
10.1002/bjs.11621, Taylor & Francis's 10.1080/14397595.2020.1868688; Windows, 2026-11-22: no PDF tried, the rules
|
|
418
|
+
above building and accepting only ``<prefix>/<journal>/<id>``). Their PDF names neither the DOI nor its suffix
|
|
419
|
+
(``/mr/article-pdf/31/6/1215/40675914/mr1215.pdf``): the article page's own citation PDF (``citation_doi`` exactly
|
|
420
|
+
this DOI) is the only candidate and the only PDF accepted, as on Silverchair's other sites
|
|
421
|
+
(``binds_pdf_to_citation``); its CDN copy is told by its file name along the redirect (``binds_response_url``)."""
|
|
422
|
+
|
|
423
|
+
doi_pattern = r"10\.\d{4,9}/[^/]+"
|
|
424
|
+
binds_pdf_to_citation = True
|
|
425
|
+
binds_response_url = True
|
|
426
|
+
pdf_cdn_redirects = False
|
|
427
|
+
|
|
428
|
+
def is_article_pdf_url(self, url: str, doi: str = "") -> bool | None:
|
|
429
|
+
# With the DOI: the bound citation PDF alone (the engine's rule). Without: any article PDF of the site, so that
|
|
430
|
+
# another article's is told apart from this one's.
|
|
431
|
+
return None if doi else super().is_article_pdf_url(url)
|
|
@@ -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'}"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"""Sage Journals: every journal on journals.sagepub.com, DOI paths.
|
|
2
2
|
|
|
3
|
+
Article pages are ``/doi/[abs|full|pdf|epdf/]<DOI>`` for any DOI: Sage's own ``10.1177/`` and the
|
|
4
|
+
prefixes of the journals it took over, kept as they were (Crossref, 2026-11-22: ``10.1191/`` of the
|
|
5
|
+
Hodder Arnold journals, ``10.1258/`` of the Royal Society of Medicine Press journals).
|
|
3
6
|
One site type so far. The institution login is the "Institution" link in the
|
|
4
7
|
article's access panel (``/action/ssostart`` with the article as redirectUri).
|
|
5
8
|
The panel's "Access via <school> is not available as they do not subscribe to
|
|
@@ -17,7 +20,7 @@ from ...engine.batch_common import _is_browser_error, open_page
|
|
|
17
20
|
from ..base import PublisherAdapter, SupplementLink, register
|
|
18
21
|
from ..platforms.atypon import CURRENT_TEMPLATE_FULLTEXT_IMAGES_JS, CURRENT_TEMPLATE_FULLTEXT_SHOWN_JS
|
|
19
22
|
|
|
20
|
-
_ARTICLE = re.compile(r"/doi/(?:(?:abs|full|pdf|epdf)/)?10
|
|
23
|
+
_ARTICLE = re.compile(r"/doi/(?:(?:abs|full|pdf|epdf)/)?10\.\d{4,9}/")
|
|
21
24
|
_SUPPLEMENT_ROWS_JS = """() => [...document.querySelectorAll('a[href*="/suppl_file/"]')]
|
|
22
25
|
.map(a => ({href: a.href, label: (a.innerText || '').replace(/\\s+/g, ' ').trim().slice(0, 200)}))"""
|
|
23
26
|
_PANEL_TEXT_JS = """() => { const panel = document.querySelector('#core-collateral-purchase-access');
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""Thieme: journals on thieme-connect.de and thieme-connect.com.
|
|
2
2
|
|
|
3
|
-
Article pages are ``/products/ejournals/(abstract|fulltext|pdf)
|
|
3
|
+
Article pages are ``/products/ejournals/(abstract|fulltext|pdf)/<DOI>``: Thieme's own ``10.1055/``, and the
|
|
4
|
+
DOIs of the journals it took over, kept as they were (Schattauer's ``10.1160/``: Thrombosis and Haemostasis,
|
|
5
|
+
2026-11-22, whose login had not been followed for it).
|
|
4
6
|
The institution login runs on profile.thieme.de: the login page links the
|
|
5
7
|
Shibboleth search, which links the federation chooser
|
|
6
8
|
(``/HTML/sso/ejournals/shibboleth.htm``, "China (CARSI)"). Its session
|
|
@@ -15,7 +17,7 @@ import time
|
|
|
15
17
|
from typing import Any
|
|
16
18
|
from urllib.parse import parse_qs, unquote, urlencode, urljoin, urlparse
|
|
17
19
|
|
|
18
|
-
from ...engine.fulltext_page import MATHJAX_SOURCES_JS
|
|
20
|
+
from ...engine.fulltext_page import MATHJAX_SOURCES_JS, paragraph_text_js
|
|
19
21
|
from ...engine.router import is_thieme_article_pdf_url
|
|
20
22
|
from ...engine.batch_common import _is_browser_error, open_page
|
|
21
23
|
from ..base import PublisherAdapter, SupplementLink, register
|
|
@@ -33,14 +35,7 @@ _SUPPLEMENT_ROWS_JS = """() => [...document.querySelectorAll('a[href]')].map(a =
|
|
|
33
35
|
# one is taken, as the converter does; the general sample rules had the thumbnails. The
|
|
34
36
|
# references are in the page (Endoscopy International Open, pages saved after a school
|
|
35
37
|
# login, 2026-11-14).
|
|
36
|
-
FULLTEXT_SHOWN_JS = """
|
|
37
|
-
const body = document.querySelector('#sections > section#htmlfulltext');
|
|
38
|
-
if (!body) return false;
|
|
39
|
-
const text = [...body.querySelectorAll('p')]
|
|
40
|
-
.filter((p) => !p.closest('ul.literaturliste, .articleBox'))
|
|
41
|
-
.reduce((total, p) => total + (p.textContent || '').length, 0);
|
|
42
|
-
return text > 500;
|
|
43
|
-
}"""
|
|
38
|
+
FULLTEXT_SHOWN_JS = paragraph_text_js("p", "ul.literaturliste, .articleBox", "> 500", root="#sections > section#htmlfulltext")
|
|
44
39
|
FULLTEXT_IMAGES_JS = """() => {
|
|
45
40
|
const body = document.querySelector('#sections > section#htmlfulltext');
|
|
46
41
|
if (!body) return [];
|
|
@@ -105,7 +100,7 @@ class ThiemeAdapter(PublisherAdapter):
|
|
|
105
100
|
def is_success_article_url(self, url: str) -> bool | None:
|
|
106
101
|
parsed = urlparse(url.lower())
|
|
107
102
|
return (parsed.scheme == "https" and parsed.netloc in _HOSTS
|
|
108
|
-
and bool(re.fullmatch(r"/products/ejournals/(?:abstract|fulltext|pdf)/10
|
|
103
|
+
and bool(re.fullmatch(r"/products/ejournals/(?:abstract|fulltext|pdf)/10\.\d{4,9}/[^/]+", parsed.path)))
|
|
109
104
|
|
|
110
105
|
def is_article_pdf_url(self, url: str, doi: str = "") -> bool | None:
|
|
111
106
|
return is_thieme_article_pdf_url(url, doi) and not self.d._is_supplementary_url(url)
|