papersearch 0.6.7 → 0.6.8
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/dist/capabilities/pdf-discovery/batch.js +9 -1
- package/dist/capabilities/pdf-discovery/batch.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batchSummary.js +9 -1
- package/dist/capabilities/pdf-discovery/batchSummary.js.map +1 -1
- package/dist/capabilities/pdf-discovery/outputLayout.d.ts +8 -1
- package/dist/capabilities/pdf-discovery/outputLayout.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/outputLayout.js +76 -6
- package/dist/capabilities/pdf-discovery/outputLayout.js.map +1 -1
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.js +2 -0
- package/dist/capabilities/pdf-discovery/school/SchoolAttempt.js.map +1 -1
- package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.js +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +2 -0
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/platforms/CrossrefSearcher.d.ts +7 -0
- package/dist/platforms/CrossrefSearcher.d.ts.map +1 -1
- package/dist/platforms/CrossrefSearcher.js +14 -0
- package/dist/platforms/CrossrefSearcher.js.map +1 -1
- package/dist/platforms/PubMedSearcher.d.ts +5 -0
- package/dist/platforms/PubMedSearcher.d.ts.map +1 -1
- package/dist/platforms/PubMedSearcher.js +62 -1
- package/dist/platforms/PubMedSearcher.js.map +1 -1
- package/package.json +1 -1
- package/school/README.md +2 -2
- package/school/paper_search_school/adapters/base.py +5 -0
- package/school/paper_search_school/adapters/platforms/atypon/__init__.py +7 -0
- package/school/paper_search_school/assets/capsule.html +11 -10
- package/school/paper_search_school/assets/capsule_en.json +2 -5
- package/school/paper_search_school/blocked_journals.py +39 -0
- package/school/paper_search_school/browser/foreground.py +11 -0
- package/school/paper_search_school/download_diagnostics.py +1 -1
- package/school/paper_search_school/engine/batch.py +6 -1
- package/school/paper_search_school/engine/batch_access.py +10 -0
- package/school/paper_search_school/engine/batch_login.py +16 -3
- package/school/paper_search_school/engine/batch_user.py +12 -0
- package/school/paper_search_school/engine/bridge.py +27 -4
- package/school/paper_search_school/orchestrator.py +3 -0
- package/school/paper_search_school/progress_capsule.py +26 -11
- package/school/paper_search_school/progress_view.py +16 -5
- package/skills/paper-search/SKILL.md +2 -2
- package/skills/paper-search/references/browser-download.md +4 -4
- package/skills/paper-search/references/cli-contract.md +1 -1
- package/skills/paper-search/references/publisher-support.md +1 -1
|
@@ -15,7 +15,7 @@ from urllib.parse import unquote, urljoin, urlparse
|
|
|
15
15
|
from . import access_rules
|
|
16
16
|
from .login_wait import LoginWait
|
|
17
17
|
from .. import federations, progress_reporter
|
|
18
|
-
from .batch_common import (AWAY_WAIT_SEC, POLL_MS, DownloadResult, PublisherContentError, _is_browser_error,
|
|
18
|
+
from .batch_common import (AWAY_WAIT_SEC, POLL_MS, DownloadResult, PublisherAccessBlocked, PublisherContentError, _is_browser_error,
|
|
19
19
|
_is_navigation_cut, open_page, pump_until, settle)
|
|
20
20
|
|
|
21
21
|
# A site without a publisher profile (publishers/site.py) whose article page
|
|
@@ -75,6 +75,9 @@ class LoginMixin:
|
|
|
75
75
|
self._raise_on_publisher_content_error(page)
|
|
76
76
|
self._dismiss_cookie_banners(page, result)
|
|
77
77
|
snapshot = self._access_snapshot(page) if not self._is_auth_page(str(page.url)) else None
|
|
78
|
+
if snapshot is not None and self._ip_blocked_text(snapshot.text):
|
|
79
|
+
# Science, 2026-11-16: the driver went on to the school's login and waited out its time.
|
|
80
|
+
raise PublisherAccessBlocked("publisher_access_blocked")
|
|
78
81
|
if self._institution_pdf_entitlement_missing(page, snapshot=snapshot):
|
|
79
82
|
return False
|
|
80
83
|
if self._pdf_first_unless_signed_out(page, result, snapshot=snapshot):
|
|
@@ -273,6 +276,12 @@ class LoginMixin:
|
|
|
273
276
|
result._login_wait = None
|
|
274
277
|
self._set_login_attention(result, "")
|
|
275
278
|
|
|
279
|
+
def _at_login_landing(self, url: str, result: DownloadResult) -> bool:
|
|
280
|
+
"""The publisher's own page its login ends on (``is_login_landing``), after
|
|
281
|
+
this paper chose the school."""
|
|
282
|
+
return (self.adapter.is_login_landing(url)
|
|
283
|
+
and any(e.get("state") in self._SCHOOL_CHOSEN for e in result.events))
|
|
284
|
+
|
|
276
285
|
def _complete_login_steps(self, page: Any, result: DownloadResult) -> bool:
|
|
277
286
|
own = self.adapter.complete_login(page, result)
|
|
278
287
|
if own is not None:
|
|
@@ -414,13 +423,17 @@ class LoginMixin:
|
|
|
414
423
|
after_login, returned, last_probe = returned and self._school_login_done(), False, time.time()
|
|
415
424
|
if self._probe_pdf_while_waiting(page, result, after_login=after_login):
|
|
416
425
|
return False # signed in, and the page still offers or denies the article
|
|
417
|
-
elif (
|
|
426
|
+
elif (on_publisher and article_returns < 2
|
|
427
|
+
and (visited_idp or self._at_login_landing(here.geturl(), result))
|
|
418
428
|
and not self._is_success_article_url(here.geturl())
|
|
419
429
|
and not self._is_auth_page(here.geturl())
|
|
420
430
|
and not self._challenge_shell(page)):
|
|
421
431
|
# Back from the IdP on a publisher page that is neither the
|
|
422
432
|
# article nor a login/chooser page (Taylor & Francis drops the
|
|
423
|
-
# redirect and lands on its home page): open the article.
|
|
433
|
+
# redirect and lands on its home page): open the article. So too
|
|
434
|
+
# on the page a publisher's login ends on once the school was chosen,
|
|
435
|
+
# its sign-in still valid and the IdP passed unseen between two
|
|
436
|
+
# passes (Science: choosing the school again there was no login).
|
|
424
437
|
article_returns += 1
|
|
425
438
|
try:
|
|
426
439
|
open_page(page, result.article_url, timeout_ms=60_000)
|
|
@@ -11,6 +11,7 @@ Part of ``PublisherBatchDownloader`` (batch.py), which combines the mixins."""
|
|
|
11
11
|
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
|
+
import os
|
|
14
15
|
import sys
|
|
15
16
|
import threading
|
|
16
17
|
import time
|
|
@@ -77,6 +78,17 @@ class UserRequestsMixin:
|
|
|
77
78
|
self._event(result, "browser_focus_unavailable", type(exc).__name__)
|
|
78
79
|
pid = 0
|
|
79
80
|
progress_reporter.update(browser_pid=pid)
|
|
81
|
+
elif os.name == "nt":
|
|
82
|
+
# The window raises the browser itself, as on macOS: a request left for this
|
|
83
|
+
# article's watch was lost once the watch had ended (Windows, 2026-11-16).
|
|
84
|
+
from ..browser.foreground import browser_pids
|
|
85
|
+
|
|
86
|
+
try:
|
|
87
|
+
pids = browser_pids(page, self.config)
|
|
88
|
+
except Exception as exc:
|
|
89
|
+
self._event(result, "browser_focus_unavailable", type(exc).__name__)
|
|
90
|
+
pids = []
|
|
91
|
+
progress_reporter.update(browser_pids=pids)
|
|
80
92
|
|
|
81
93
|
def watch() -> None:
|
|
82
94
|
while not stop.wait(1.0):
|
|
@@ -57,6 +57,9 @@ _FAILURE_KINDS = {
|
|
|
57
57
|
"supplements_only": ("supplements_only", "supplements_only"),
|
|
58
58
|
# The DOI resolves to no site to sign in on (publishers/site.py): no driver can run.
|
|
59
59
|
"unsupported_publisher": ("unsupported_publisher", "review_publisher_profiles"),
|
|
60
|
+
# doi.org answered no address for the DOI (a paper online days before its DOI is
|
|
61
|
+
# registered, Science 2026-11-15) and the publisher's article page is only reached through it.
|
|
62
|
+
"doi_not_resolved": ("doi_not_resolved", "retry_later"),
|
|
60
63
|
# A site without a publisher profile: the shared rules found no institution entry.
|
|
61
64
|
"generic_institution_entry_missing": ("generic_institution_entry_missing", "review_publisher_profiles"),
|
|
62
65
|
**{code: (code, "review_browser") for code in _LOGIN_FAILURE_CODES},
|
|
@@ -260,10 +263,16 @@ def _try_builtin_institutional(
|
|
|
260
263
|
|
|
261
264
|
# Step 1: Resolve DOI to publisher URL
|
|
262
265
|
resolved_url = _resolve_doi(doi)
|
|
266
|
+
if not resolved_url and profile:
|
|
267
|
+
# A paper is online at its publisher days before doi.org knows its DOI (Science,
|
|
268
|
+
# 2026-11-15): the profile's own article address opens it all the same.
|
|
269
|
+
resolved_url = _own_article_url(profile, doi)
|
|
270
|
+
if resolved_url:
|
|
271
|
+
log.info(" [Institutional] DOI not at doi.org yet: the publisher's article page")
|
|
263
272
|
if not resolved_url:
|
|
264
273
|
log.info(" [Institutional] Could not resolve DOI")
|
|
265
274
|
# Without a profile there is no site to build one for.
|
|
266
|
-
return
|
|
275
|
+
return _failure(doi, "doi_not_resolved") if profile else _unsupported_publisher(doi)
|
|
267
276
|
|
|
268
277
|
if not profile:
|
|
269
278
|
from ..publishers.profiles import infer_publisher_profile_from_url
|
|
@@ -300,7 +309,7 @@ def _try_builtin_institutional(
|
|
|
300
309
|
"error_type": "no_entitlement", "reason": "user_marked_no_entitlement",
|
|
301
310
|
"action": "skipped_by_user", "entitlement": remembered}
|
|
302
311
|
from .. import blocked_journals
|
|
303
|
-
blocked_by = blocked_journals.
|
|
312
|
+
blocked_by = blocked_journals.skip_for(identity, doi)
|
|
304
313
|
if blocked_by:
|
|
305
314
|
log.info(" [Institutional] Skipped: this journal's site blocked the current network (%s)", blocked_by)
|
|
306
315
|
return {"success": False, "identifier": doi, "doi": doi, "source": "institutional:blocked_journal",
|
|
@@ -396,12 +405,26 @@ def _try_builtin_institutional(
|
|
|
396
405
|
return None
|
|
397
406
|
|
|
398
407
|
|
|
399
|
-
def
|
|
400
|
-
error_type, action = _FAILURE_KINDS[
|
|
408
|
+
def _failure(doi: str, kind: str) -> dict[str, Any]:
|
|
409
|
+
error_type, action = _FAILURE_KINDS[kind]
|
|
401
410
|
return {"success": False, "identifier": doi, "doi": doi, "source": "institutional",
|
|
402
411
|
"error_type": error_type, "reason": error_type, "action": action}
|
|
403
412
|
|
|
404
413
|
|
|
414
|
+
def _unsupported_publisher(doi: str) -> dict[str, Any]:
|
|
415
|
+
return _failure(doi, "unsupported_publisher")
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def _own_article_url(profile: Any, doi: str) -> str:
|
|
419
|
+
"""The profile's article address for ``doi`` when it is the publisher's own, not doi.org's."""
|
|
420
|
+
try:
|
|
421
|
+
url = profile.article_url(doi)
|
|
422
|
+
except (AttributeError, KeyError, IndexError, ValueError):
|
|
423
|
+
return ""
|
|
424
|
+
host = (urlparse(url).hostname or "").lower()
|
|
425
|
+
return url if url.startswith("https://") and host and not (host == "doi.org" or host.endswith(".doi.org")) else ""
|
|
426
|
+
|
|
427
|
+
|
|
405
428
|
def _resolve_doi(doi: str) -> str | None:
|
|
406
429
|
"""Resolve a DOI to the publisher landing URL that doi.org redirects to.
|
|
407
430
|
|
|
@@ -143,6 +143,9 @@ def _download_impl(doi: str, output_dir: str | Path | None, *,
|
|
|
143
143
|
except Exception as exc:
|
|
144
144
|
log.info(f" [Institutional] route exception: {type(exc).__name__}")
|
|
145
145
|
return fail(doi, "institutional route raised", error_type="source_exception", action="review_logs")
|
|
146
|
+
# An article that re-checked a blocked journal's site: open again unless blocked again.
|
|
147
|
+
from . import blocked_journals
|
|
148
|
+
blocked_journals.recheck_ended(doi, blocked=bool(result) and result.get("error_type") == "access_blocked")
|
|
146
149
|
|
|
147
150
|
if result is None:
|
|
148
151
|
return fail(
|
|
@@ -252,12 +252,25 @@ class Api:
|
|
|
252
252
|
pid = state.get("browser_pid")
|
|
253
253
|
if not isinstance(pid, int) or pid <= 0 or not activate_mac(pid):
|
|
254
254
|
return "未能切到下载浏览器,请从程序坞打开"
|
|
255
|
-
if os.name == "nt"
|
|
256
|
-
# The
|
|
257
|
-
#
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
255
|
+
if os.name == "nt":
|
|
256
|
+
# The window raises the browser itself, as on macOS, whatever the paper
|
|
257
|
+
# is fetching and between papers: a request left for the article's watch
|
|
258
|
+
# was lost once the watch had ended (Windows, 2026-11-16).
|
|
259
|
+
pids = [p for p in state.get("browser_pids") or [] if isinstance(p, int) and p > 0]
|
|
260
|
+
if pids:
|
|
261
|
+
from .browser.foreground import activate_windows
|
|
262
|
+
|
|
263
|
+
if not activate_windows(pids):
|
|
264
|
+
return "未能切到下载浏览器,请从任务栏打开"
|
|
265
|
+
if isinstance(state.get("owner_pid"), int) and state["owner_pid"] > 0:
|
|
266
|
+
# The click gives this foreground window permission to let
|
|
267
|
+
# the exact backend process activate its browser on Windows.
|
|
268
|
+
import ctypes
|
|
269
|
+
|
|
270
|
+
ctypes.windll.user32.AllowSetForegroundWindow(state["owner_pid"])
|
|
271
|
+
if state.get("awaiting_next"):
|
|
272
|
+
# Between papers no article watches for requests: raised above, nothing to leave.
|
|
273
|
+
return "已切到下载浏览器"
|
|
261
274
|
|
|
262
275
|
request_action(str(current), str(action), str(run_id))
|
|
263
276
|
return progress_view.ACTION_FEEDBACK[str(action)]
|
|
@@ -295,7 +308,7 @@ class Api:
|
|
|
295
308
|
return "已在浏览器打开这篇文章" if opened else "打开失败:没有找到默认浏览器"
|
|
296
309
|
|
|
297
310
|
def open_folder(self) -> bool:
|
|
298
|
-
return progress_view.open_folder(
|
|
311
|
+
return progress_view.open_folder(progress_view.batch_folder(read_papers(), read_state()))
|
|
299
312
|
|
|
300
313
|
# --- the lists behind 成功, 失败 and 剩余 ---------------------------------
|
|
301
314
|
def _papers_batch(self) -> str:
|
|
@@ -312,15 +325,17 @@ class Api:
|
|
|
312
325
|
return progress_view.paper_lists(read_papers(), read_state())
|
|
313
326
|
|
|
314
327
|
def show_paper(self, index: int) -> str:
|
|
315
|
-
"""A saved
|
|
316
|
-
recorded for it,
|
|
328
|
+
"""A saved paper of the running or finished batch, shown in its folder: the file the batch
|
|
329
|
+
recorded for it (its PDF, else what it saved of it: a batch of the supplementary files or the
|
|
330
|
+
Markdown alone has no PDF, 2026-11-16), wherever the paper was sent (folders of their own by
|
|
331
|
+
topic, user 2026-11-11). The file is only selected in its folder, never opened."""
|
|
317
332
|
listed, state = read_papers() or {}, read_state() or {}
|
|
318
333
|
key = str(index) if isinstance(index, int) and not isinstance(index, bool) else ""
|
|
319
334
|
paper = (listed.get("papers") or {}).get(key) if listed.get("batch_id") == state.get("batch_id") else None
|
|
320
335
|
path = str((paper or {}).get("path") or "") if (paper or {}).get("state") == "ok" else ""
|
|
321
336
|
real = os.path.realpath(path) if path else ""
|
|
322
|
-
if not real
|
|
323
|
-
return "
|
|
337
|
+
if not real:
|
|
338
|
+
return "打开失败:这篇没有保存的文件"
|
|
324
339
|
if not progress_view.reveal_file(real):
|
|
325
340
|
return "打开失败:文件已被移走或删除"
|
|
326
341
|
return "已打开所在文件夹"
|
|
@@ -37,8 +37,6 @@ ACTION_FEEDBACK = {
|
|
|
37
37
|
"resume_held": "已收到:这一篇下完后接着下暂停的篇目",
|
|
38
38
|
"stop_batch": "已终止任务:这一篇结束,剩下的不再下载",
|
|
39
39
|
"skip_item": "已跳过本篇,进入下一篇",
|
|
40
|
-
"skip_journal": "已记住:本刊无权限,以后自动跳过(可用 entitlements 撤销)",
|
|
41
|
-
"skip_publisher": "已记住:该出版社无权限,以后自动跳过",
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
TERMINAL_STATUSES = frozenset({"done", "failed", "cancelled", "interrupted"})
|
|
@@ -432,9 +430,11 @@ def view(state: dict[str, Any] | None, now: float) -> dict[str, Any]:
|
|
|
432
430
|
if not running and state.get("stage") == "supplements_checked" else "",
|
|
433
431
|
"summary": summary_view(state.get("results")) if mode == "done" else None,
|
|
434
432
|
"actions": running and bool(current) and not awaiting,
|
|
435
|
-
# This paper has a download browser to show: not
|
|
436
|
-
#
|
|
437
|
-
|
|
433
|
+
# This paper has a download browser to show: not in the caller's open-access stretch
|
|
434
|
+
# (its channel), which opens none; between papers too once the window knows the
|
|
435
|
+
# browser's processes, to raise it itself (2026-11-16).
|
|
436
|
+
"browser": running and bool(current) and not state.get("channel")
|
|
437
|
+
and (not awaiting or bool(state.get("browser_pid") or state.get("browser_pids"))),
|
|
438
438
|
"stop_left": max(0, total - done - 1),
|
|
439
439
|
"held": held, "held_wait": held_wait,
|
|
440
440
|
"folder": bool(state.get("output_dir")),
|
|
@@ -487,6 +487,17 @@ def dark_mode() -> bool:
|
|
|
487
487
|
return False
|
|
488
488
|
|
|
489
489
|
|
|
490
|
+
def batch_folder(listed: Any, state: dict[str, Any] | None) -> str:
|
|
491
|
+
"""The folder the window's 文件夹 opens: the running batch's download folder (its
|
|
492
|
+
papers file says it), else the task's folder. Each article's visit records its own
|
|
493
|
+
folder as the task's, and the button opened the last paper's (Windows, 2026-11-16)."""
|
|
494
|
+
state = state or {}
|
|
495
|
+
if (isinstance(listed, dict) and listed.get("batch_id") and listed.get("batch_id") == state.get("batch_id")
|
|
496
|
+
and isinstance(listed.get("folder"), str) and listed["folder"]):
|
|
497
|
+
return listed["folder"]
|
|
498
|
+
return str(state.get("output_dir") or "")
|
|
499
|
+
|
|
500
|
+
|
|
490
501
|
def open_folder(path: str) -> bool:
|
|
491
502
|
"""Open a folder in Finder / Explorer; False when it is missing."""
|
|
492
503
|
if not path or not os.path.isdir(path):
|
|
@@ -4,7 +4,7 @@ description: |
|
|
|
4
4
|
用本机 paper-search 命令做文献工作:检索论文、核对 DOI/PMID、搜正文片段(找方法和结果的原文)、查期刊影响因子与分区、查施引和参考文献、下载全文和补充材料。
|
|
5
5
|
用户要找文献、查期刊、下载论文,或说“请开始配置”时使用;英文请求(literature search、journal metrics、paper download、start setup)同样适用。
|
|
6
6
|
metadata:
|
|
7
|
-
version: "0.6.
|
|
7
|
+
version: "0.6.8"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# 文献检索与下载(paper-search)
|
|
@@ -173,4 +173,4 @@ paper-search doctor --pretty
|
|
|
173
173
|
- 不写论文正文,不做语言润色。
|
|
174
174
|
- 不把 API key、token、Cookie 写入 Skill、README 或回复。
|
|
175
175
|
|
|
176
|
-
下载结果在下载文件夹(`savePath`,没传时用 `DEFAULT_DOWNLOAD_PATH`)里这次新建的 `<年月日-时分秒>_PaperSearchDownload/`:PDF 直接放在里面,取到了补充材料的论文才单独一个文件夹(正文和 `supplements/`)。出过问题的篇目的诊断记录和截图在结果 `runLog` 所指运行记录目录的 `diagnostics/` 里(可能带登录信息,不要发给别人;30
|
|
176
|
+
下载结果在下载文件夹(`savePath`,没传时用 `DEFAULT_DOWNLOAD_PATH`)里这次新建的 `<年月日-时分秒>_PaperSearchDownload/`:PDF 直接放在里面,取到了补充材料的论文才单独一个文件夹(正文和 `supplements/`)。出过问题的篇目的诊断记录和截图在结果 `runLog` 所指运行记录目录的 `diagnostics/` 里(可能带登录信息,不要发给别人;30 天后自动删除)。正文按“期刊缩写_年月_标题”命名,附件保留原名;使用结果返回的实际 `path` / `supplements[].file`,不要自行拼 DOI 文件名。过长名称会截短,完整标题见返回结果。
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
- 同一个数据目录同时只跑一个下载。命令没结束时,不因窗口看似停住而重新下载或登录。
|
|
20
20
|
- 机构下载一次一篇,开放渠道同时查后面的篇目。遇到学校登录或验证时停在这一篇;出现人工处理提示后,提醒用户到下载浏览器操作。等待时限:停在学校登录页(以及没配置学校、要用户自己选学校的页面)最多 3 分钟(后端配置 `browser_login_timeout`,秒);停在其他页面(人机验证、出版社页面、选机构页、取 PDF 时等待处理)连续超过 1 分钟就结束这一篇(`browser_page_wait_timeout`)。两项都能在进度窗口右上角的设置(齿轮)里改,从下一篇起生效。学校统一认证登录一次后,其余篇目通常自动通过。一篇等满时限后(日志写“这一篇等你登录或验证已到时限”),后面每篇只等 60 秒;用户在登录框输入时照常等。
|
|
21
21
|
- 每个出版社每小时最多打开 100 篇(后端配置 `publisher_hourly_limit`,0 为不限)。到上限时批量等到可以继续再下这一篇(日志写明时间);单篇返回 `rate_limited`,稍后再试。
|
|
22
|
-
- 出版社网站拦截了当前网络(`access_blocked`,如 Cloudflare
|
|
22
|
+
- 出版社网站拦截了当前网络(`access_blocked`,如 Cloudflare 拦截页、出版社自己的“IP 已被封锁”页)时这一篇结束;同一期刊的其他文章暂时直接跳过(`journal_blocked_earlier`),每 5 分钟用一篇再试一次网站,能打开就照常继续(换了网络不用等半小时),其他期刊照常继续。告诉用户可能是当前网络被网站防护拦截,也可能是下载过多被暂停:可换网络或稍后再试,后者请联系学校图书馆。
|
|
23
23
|
- 后端会先短暂等待自动验证,每次验证等待对可识别的 Turnstile 复选框最多尝试点击 3 次,两次至少间隔 3 秒;程序提示人工处理时,再提醒用户到下载浏览器接管,不因 `checking_access` 就要求用户操作。学校登录、二次验证和复杂验证码由用户完成(reCAPTCHA、hCaptcha、滑块等验证页,程序认出后直接交给用户);学校认证页的信息发送同意和使用条款、出版社登录途中的条款确认页由后端代点同意(每篇各最多两次,仍停在那一页时才提醒用户)。不索取账号、密码或验证码,agent 不另开浏览器代操作。
|
|
24
24
|
- 在专用人工登录页输入、选择或点击控件,或点击胶囊接管登录后,暂停剩余学校登录预算;输入间停顿不算离开,离开该人工步骤后恢复计时。无人操作仍按原限时结束。不要询问用户的账号密码。用户在登录页中途停下(比如去拿手机验证码)时继续等,按原来的时限算,不重新发起登录。
|
|
25
25
|
- 学校登录提醒依赖当前可见的账号、密码、二次验证码、二维码,或后端没能代点的同意步骤;学校域名和空闲时间不作为人工操作证据。胶囊“提醒你操作前最多等”仍保存到 `browser_stall_notify_after`(默认 30 秒,1–600);可见验证控件无法自动操作时,按该值与剩余预算一半的较早者交接。控件仍在加载、已勾选处理中或尚未出现时继续自动观察。未派发点击不消耗最多 3 次输入额度;失败原因见 `challenge_observation`。明确网站封禁和预算耗尽仍结束当前路径,不保证所有验证码自动通过。程序认不出的页面停住达到这个时长、页面上又有可点的控件时,也会提醒“页面可能需要你处理”,同样请用户到下载浏览器看一眼。
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
- 当前源码(未发布修复):`browser_operation_timeout` 表示自动页面操作耗尽共享预算,不是无权限,也不是等待用户登录。不要因此反复登录;先检查是否误用了 `entitled_only`。附件阶段终止同样停止后续篇目,保留已保存的正文。
|
|
41
41
|
- 展开后写明正在下哪部分和哪一步:正文有五段步骤条(打开文章、权限、取 PDF、核对、附录),附录显示“附录 2/5”。
|
|
42
42
|
- 右上角齿轮(设置):手动输入学校登录页、其他页面的最长等待(秒)、页面持续无进展的提醒时间(默认 30 秒)和每家出版社每小时最多下载篇数,保存后用于后续篇目;“系统通知”开关点击即保存,可随时开启或关闭;关闭后胶囊仍变色呼吸,点击提醒仍可唤回浏览器。
|
|
43
|
-
-
|
|
43
|
+
- “跳过”:只结束当前这一篇,点击后 1–2 秒内生效。学校有没有权限由下载自己判断,进度窗口里不用标;“⋯”打开“报告问题”。
|
|
44
44
|
- “⋯”里的“报告问题”:用户选择看到的问题后,后端截下页面并处理(读取已打开的 PDF、回到文章、刷新、停止自动选校),窗口显示处理结果。
|
|
45
45
|
- 发起机构下载时同时监听用户的报告(与下载相同的 `SCHOOL_DATA_DIR`):
|
|
46
46
|
- 能后台运行命令并在结束时收到通知:后台运行 `paper-search-school issues watch --since <开始下载的时间戳>`,用户报告后它返回报告 JSON(网址、标题、正文片段、截图路径、处理结果)并退出。
|
|
@@ -90,7 +90,7 @@ paper-search failures --format text
|
|
|
90
90
|
| 类别 | 常见 code | 怎么说、怎么做 |
|
|
91
91
|
| --- | --- | --- |
|
|
92
92
|
| 没权限(有依据) | `entitlement_missing`、`institution_federation_unavailable`、`no_entitlement` | 附上汇总里的依据(页面原话或决定性的一步)。只说本篇、当前学校没有权限,不推断整个平台。出版社没有学校所在联盟的登录路线时,建议在校园网或学校 VPN 下下载。 |
|
|
93
|
-
| 用户或外部原因 | `login_timeout`(停在学校登录页)、`login_paused`(这家出版社的学校登录在本批中途失效,这篇暂停、没试;不代表没有权限)、`login_page_closed`、`login_credentials_rejected`、`captcha_required`、`idp_login_error`、`institution_not_registered`(认证应用或入口未注册,不代表没有订阅)、`user_skipped`、`cancelled`、`access_blocked`、`cloudflare_blocked`、`publisher_content_error`、`article_not_yet_published`(论文已录用,出版社还没上线全文)、`rate_limited`、`batch_stopped`、`profile_busy` | 说明需要用户做什么(登录、验证、等待、联系图书馆),原调用结束、资源释放后再决定是否重试;不连续重新提交登录。 |
|
|
93
|
+
| 用户或外部原因 | `login_timeout`(停在学校登录页)、`login_paused`(这家出版社的学校登录在本批中途失效,这篇暂停、没试;不代表没有权限)、`login_page_closed`、`login_credentials_rejected`、`captcha_required`、`idp_login_error`、`institution_not_registered`(认证应用或入口未注册,不代表没有订阅)、`user_skipped`、`cancelled`、`access_blocked`、`cloudflare_blocked`、`publisher_content_error`、`article_not_yet_published`(论文已录用,出版社还没上线全文)、`doi_not_resolved`(doi.org 还查不到这个 DOI,常见于刚上线几天的文章;过几天再下)、`rate_limited`、`batch_stopped`、`profile_busy` | 说明需要用户做什么(登录、验证、等待、联系图书馆),原调用结束、资源释放后再决定是否重试;不连续重新提交登录。 |
|
|
94
94
|
| 暂不支持的网站 | `unsupported_platform`(如只在 ClinicalKey 上的内容)、`unsupported_publisher`(DOI 没有指向能登录的出版社网站,没有打开浏览器)、`generic_institution_entry_missing`(这家出版社还没有专门的规则,按通用规则没找到机构登录入口) | 说明这类网站还不支持,不说成没有权限;后者可以建议用户把这篇报告给维护者补规则,或在校园网下下载。 |
|
|
95
95
|
| 原因不明(需排查) | `download_failed`、`download_timeout`、`login_not_reached`(程序没进入学校登录页)、`login_required`、`source_exception`、`browser_unresponsive`、`pdf_identity_unverified`、`pdf_identity_mismatch`、`pdf_wrong_article` 等 | 不说成没有权限;说明原因待查,给出汇总里的“停在哪一步”和诊断文件位置。 |
|
|
96
96
|
|
|
@@ -125,7 +125,7 @@ paper-search failures --run <运行ID> --doi <DOI> --export ./failure-report.zip
|
|
|
125
125
|
- `download_with_fallback` / `download_batch` 的 `content`:`main`(默认,只要正文)、`supplements`(只要补充材料,不走正文的各层)、`both`(正文和补充材料)。
|
|
126
126
|
- 补充材料只经学校订阅下载的浏览器取得:正文由开放渠道拿到时,`both` 会再请它单独取补充材料;它没装或没启用时,这一步记为 `skipped`,写明没有可用的后端。
|
|
127
127
|
- 哪些出版社有补充材料规则见 `publisher-support.md`。完成检查但页面未列出附件时返回空 `supplements`,attempt 为 `skipped/no_supplements`;只取补充材料时整体 `status=ok`,表示检查完成,不表示保存了文件。这家网站没有补充材料专门规则时先按通用规则取文章页补充材料区块里地址带本文 DOI 的文件,仍没有找到时 attempt 为 `skipped/supplements_not_supported`,整体仍为 `ok`:不知道有没有附件,告诉用户“网站暂不支持自动下载附录”,需要的话打开文章页手动下载,不要说成没有附录。登录未完成(`login_required`)、验证未完成(`challenge_timeout`)、网站的人机验证页挡住了附件下载(`verification_page`,如 Figshare)、拿到网页而不是文件(`html_page`)与其他下载失败分别报告,只取补充材料时为 `error`,不影响已保存正文。
|
|
128
|
-
- 文件存在 `<savePath
|
|
128
|
+
- 文件存在 `<savePath>/<期刊缩写_年月_标题_短标识>/supplements/`,正文也移进这个文件夹;没取到附件的论文,正文平铺在 `<savePath>` 里;`…_supplements-manifest.json` 记录每个文件的状态(`saved`、`failed`、`skipped`)和原因,在结果 `runLog` 所指的运行记录目录里:有文件没下到时在 `diagnostics/`,都下到时在 `records/`;结果里的 `supplements` 给出实际文件路径。
|
|
129
129
|
- 上限:每篇最多 50 个文件,每个不超过 200 MB,一篇总共 3 分钟;超出的记 `skipped`(原因 `file_limit`、`too_large`、`time_budget`)。`html_page` 表示链接打开的是网页而不是文件,`http_403` 一类是网站拒绝。
|
|
130
130
|
- 只收本文的文件:别的文章的文件、本文的插图、参考文献里的链接都不收。Figshare 公开 article/collection 链接按原文 DOI 关联后解析文件;其他外部附件平台仍需适配。
|
|
131
131
|
- 补充材料、利益冲突声明里也可能印着目标标题和 DOI;不要把补充材料 PDF 当正文交付,正文成功也不代表补充材料齐全。
|
|
@@ -165,7 +165,7 @@ paper-search run download_with_fallback --json-args '{"source":"crossref","paper
|
|
|
165
165
|
|
|
166
166
|
- `"mode"`:默认 `"two_phase"`,每篇先试开放渠道,没拿到的随即走机构下载(一次一篇),两路同时进行,浏览器和学校登录在开始后几秒就出现;进度窗口按整批计数(k / N),装了学校订阅下载时,5 篇以上的批量从开头就显示;`"per_item"` 每篇走完整个漏斗;`"entitled_only"` 跳过开放渠道,每篇直接走机构下载(用于测试学校这条路)。
|
|
167
167
|
- 不传 `savePath` 时存到 `DEFAULT_DOWNLOAD_PATH`;整批或每篇都可以带自己的 `savePath`,用户指定了别的文件夹时才传。
|
|
168
|
-
- `"content"`:`"main"`(默认,只要正文)、`"supplements"`(只要本文的补充材料,不走正文的各层)、`"both"`。补充材料存在 `<savePath
|
|
168
|
+
- `"content"`:`"main"`(默认,只要正文)、`"supplements"`(只要本文的补充材料,不走正文的各层)、`"both"`。补充材料存在 `<savePath>/<期刊缩写_年月_标题_短标识>/supplements/`(只下正文时正文直接放在 `<savePath>` 里),清单与浏览器诊断在结果 `runLog` 所指运行记录目录的 `diagnostics/`(都下到时在 `records/`),结果的 `supplements` 列出每个文件的状态;只经机构下载后端获取,哪些出版社有规则见 `publisher-support.md`。
|
|
169
169
|
- 每次下载都会写一份本地运行记录,结果里的 `runLog` 是它的目录(`run.json`;`items.jsonl`,含每一层的耗时、代码,以及后端的页面事件和截图;`timeline.log`)。排查失败时读它,不要猜。结果列出每一篇和它的各次尝试。
|
|
170
170
|
|
|
171
171
|
```bash
|
|
@@ -74,4 +74,4 @@ DOI 跳转到表外的网站时,程序按通用规则尝试:找机构登录
|
|
|
74
74
|
- `institution_not_registered`:认证应用或入口未注册,或与当前认证渠道不兼容,属于外部认证配置问题;核查入口,不把它当作学校没有论文订阅。
|
|
75
75
|
- `idp_no_return_to_publisher`:学校登录后停在学校自己的网站,没回到出版社,通常也是学校没开通。
|
|
76
76
|
- `entitlement_missing`:出版社认出了学校,判定本篇不在订阅内。只说本篇、当前学校没有权限,不推断整个出版社。
|
|
77
|
-
- `no_entitlement
|
|
77
|
+
- `no_entitlement`:用 `paper-search-school entitlements set` 标过本刊或本出版社无权限,之后同刊或同出版社直接跳过;查看或撤销用 `paper-search-school entitlements`(`list` / `clear <key>`)。
|