papersearch 0.7.2 → 0.7.3
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/download/batch/batch.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batch.js +297 -14
- package/dist/capabilities/download/batch/batch.js.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.js +1 -1
- 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 +1 -1
- package/dist/capabilities/download/batch/networkLoss.js +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.js +5 -5
- package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts +16 -9
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +64 -54
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.js +61 -56
- package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.d.ts +6 -2
- package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.js +14 -3
- package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -1
- package/dist/infrastructure/school/index.d.ts +1 -1
- package/dist/infrastructure/school/index.d.ts.map +1 -1
- package/dist/infrastructure/school/types.d.ts +10 -3
- package/dist/infrastructure/school/types.d.ts.map +1 -1
- package/dist/management/failures/index.d.ts +5 -2
- package/dist/management/failures/index.d.ts.map +1 -1
- package/dist/management/failures/index.js +21 -4
- package/dist/management/failures/index.js.map +1 -1
- package/package.json +1 -1
- package/school/paper_search_school/adapters/base.py +4 -0
- package/school/paper_search_school/adapters/oup/__init__.py +20 -0
- package/school/paper_search_school/adapters/sage/__init__.py +4 -1
- package/school/paper_search_school/adapters/taylor_francis/__init__.py +3 -0
- package/school/paper_search_school/adapters/thieme/__init__.py +4 -2
- package/school/paper_search_school/assets/capsule.html +125 -49
- package/school/paper_search_school/assets/capsule_en.json +32 -54
- package/school/paper_search_school/assets/capsule_fr.json +32 -54
- package/school/paper_search_school/assets/capsule_ja.json +32 -54
- package/school/paper_search_school/assets/capsule_ko.json +32 -54
- package/school/paper_search_school/assets/capsule_zh-Hant.json +27 -53
- package/school/paper_search_school/cold_start.py +22 -11
- package/school/paper_search_school/engine/access_rules.py +3 -2
- package/school/paper_search_school/engine/batch.py +12 -4
- package/school/paper_search_school/engine/batch_access.py +21 -9
- package/school/paper_search_school/engine/batch_capture.py +1 -1
- package/school/paper_search_school/engine/batch_institution.py +130 -29
- package/school/paper_search_school/engine/bridge.py +16 -3
- package/school/paper_search_school/engine/router.py +2 -1
- package/school/paper_search_school/orchestrator.py +44 -18
- package/school/paper_search_school/progress_reporter.py +17 -8
- package/school/paper_search_school/progress_view.py +1 -1
- 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/school_switch.py +34 -52
- package/school/paper_search_school/server.py +10 -8
- package/skills/paper-search/SKILL.md +1 -1
- package/skills/paper-search/references/browser-download.md +7 -9
- package/skills/paper-search/references/publisher-support.md +2 -2
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""没权限时换下一所学校 (PaperSearch Pro; user, 2026-11-21).
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A paper the school has no access to, failed under 没权限 (signed in and refused, the school's sign-in not enabled for
|
|
4
|
+
the publisher, no route for it there, or marked by the user as without access), is tried with the next saved school:
|
|
4
5
|
one Pro fills the sign-in of, its account saved and its auto sign-in on; the default school first, then the list's
|
|
5
|
-
order. A
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
order. A download on its own switches at once. A batch switches once at its end (download/batch/batch.ts): its papers
|
|
7
|
+
all with the default school, then those without access together with the next school, and so on (user, 2026-11-22:
|
|
8
|
+
switching to and fro at each paper had a school's login ask for a picture code). Only 没权限 switches: a sign-in that
|
|
9
|
+
failed (a wrong password, a code to type, a page that stopped it) is the user's to see, not another account's. Each
|
|
10
|
+
switch forgets the sign-in before it (cold_start.before_sign_in), the batch's browser closed first to let go of it.
|
|
9
11
|
"""
|
|
10
12
|
from __future__ import annotations
|
|
11
13
|
|
|
@@ -14,8 +16,15 @@ from typing import Any
|
|
|
14
16
|
#: The switch on the sign-in page (config), on unless turned off.
|
|
15
17
|
SETTING = "school_switch"
|
|
16
18
|
|
|
17
|
-
#:
|
|
18
|
-
|
|
19
|
+
#: 没权限 besides a refusal after the sign-in (failureClass.ts): the school's sign-in not enabled for the publisher (IEEE
|
|
20
|
+
#: "Your institution may not be enabled", AHA's OpenAthens "restricted by your organization"), the publisher with no route
|
|
21
|
+
#: for it, or the user's mark, made with the default school. Another school may have it (user, 2026-11-22: IEEE was not
|
|
22
|
+
#: tried with the second school; every paper under 没权限 is).
|
|
23
|
+
NOT_THIS_SCHOOL = ("institution_not_registered", "institution_federation_unavailable", "no_entitlement")
|
|
24
|
+
|
|
25
|
+
#: Set on a download's config when its school is not the default one: the user's 没权限 marks were made with the
|
|
26
|
+
#: default school and do not skip another's visit (engine/bridge.py).
|
|
27
|
+
MARKS_OFF = "no_access_marks_off"
|
|
19
28
|
|
|
20
29
|
|
|
21
30
|
def enabled(config: dict[str, Any]) -> bool:
|
|
@@ -23,9 +32,24 @@ def enabled(config: dict[str, Any]) -> bool:
|
|
|
23
32
|
|
|
24
33
|
|
|
25
34
|
def no_access(result: dict[str, Any] | None) -> bool:
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
"""The school has no access to this article, a 没权限 failure (not a sign-in that failed)."""
|
|
36
|
+
if not result or result.get("success"):
|
|
37
|
+
return False
|
|
38
|
+
if result.get("error_type") in NOT_THIS_SCHOOL:
|
|
39
|
+
return True
|
|
40
|
+
return result.get("error_type") == "paywall" and result.get("reason_code") == "institution_pdf_entitlement_missing"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#: A failure after one of the school's entries by one name, its next entry to be tried (user, 2026-11-22: "同名学校的话,
|
|
44
|
+
#: 那就直接选一个……如果这个不行的话,再向下一个"): 没权限, or the login not reached or not finished (JAMA's first
|
|
45
|
+
#: entry of a test school was its library proxy, whose sign-in asks for a picture code).
|
|
46
|
+
ENTRY_DID_NOT_DO = ("login_not_reached", "login_timeout", "idp_no_return_to_publisher")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def entry_did_not_do(result: dict[str, Any] | None) -> bool:
|
|
50
|
+
"""The download failed after one of several entries by the school's name: the next one may do."""
|
|
51
|
+
return bool(result) and not result.get("success") and int(result.get("same_name_entries") or 0) > 1 and (
|
|
52
|
+
no_access(result) or result.get("error_type") in ENTRY_DID_NOT_DO)
|
|
29
53
|
|
|
30
54
|
|
|
31
55
|
def schools(config: dict[str, Any]) -> list[dict[str, Any]]:
|
|
@@ -56,47 +80,5 @@ def grouping(config: dict[str, Any]) -> bool:
|
|
|
56
80
|
return enabled(config) and len(schools(config)) > 1
|
|
57
81
|
|
|
58
82
|
|
|
59
|
-
def _task() -> str:
|
|
60
|
-
from . import progress_reporter
|
|
61
|
-
|
|
62
|
-
return progress_reporter.batch_id()
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def journal(doi: str) -> str:
|
|
66
|
-
"""The journal's key: its ISSNs (Crossref, kept), else its title; "" when not known."""
|
|
67
|
-
from .entitlements import journal_identity
|
|
68
|
-
|
|
69
|
-
try:
|
|
70
|
-
identity = journal_identity(doi)
|
|
71
|
-
except Exception:
|
|
72
|
-
return ""
|
|
73
|
-
issns = identity.get("issn") or []
|
|
74
|
-
return "issn:" + ",".join(sorted(issns)) if issns else str(identity.get("journal") or "").strip().lower()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def remembered(doi: str) -> str:
|
|
78
|
-
"""The school (entityID) that got this article's journal earlier in this task; "" when none or not in a task."""
|
|
79
|
-
task = _task()
|
|
80
|
-
key = journal(doi) if task else ""
|
|
81
|
-
return _GOT.get((task, key), "") if key else ""
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def remember(doi: str, entity: str) -> None:
|
|
85
|
-
task = _task()
|
|
86
|
-
key = journal(doi) if task and entity else ""
|
|
87
|
-
if key:
|
|
88
|
-
_GOT[(task, key)] = entity
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def order_for(config: dict[str, Any], doi: str) -> list[dict[str, Any]]:
|
|
92
|
-
"""The schools to try for this article, in turn: its journal's school of this task first, then the default one
|
|
93
|
-
and the rest."""
|
|
94
|
-
listed = schools(config)
|
|
95
|
-
if len(listed) < 2:
|
|
96
|
-
return listed # nothing to switch to: no journal looked up
|
|
97
|
-
first = remembered(doi)
|
|
98
|
-
return sorted(listed, key=lambda entry: str(entry.get("idp_entity_id") or "").strip() != first) if first else listed
|
|
99
|
-
|
|
100
|
-
|
|
101
83
|
def name(entry: dict[str, Any]) -> str:
|
|
102
84
|
return str(entry.get("school_name") or entry.get("school_name_en") or entry.get("idp_entity_id") or "")
|
|
@@ -244,15 +244,18 @@ async def school_keep_session() -> str:
|
|
|
244
244
|
|
|
245
245
|
@mcp_app.tool()
|
|
246
246
|
def school_switch_state() -> str:
|
|
247
|
-
"""
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
"""The schools a batch's papers without access (没权限) are tried with at its end, one after another
|
|
248
|
+
(没权限时换下一所学校, school_switch.py): the default one first, each named as ``school_download``'s ``school``
|
|
249
|
+
takes it (its entityID); none while the switch is off; and whether the batch takes one journal's papers one after
|
|
250
|
+
another (``group``: on and more than one school). Opens no browser. Answers
|
|
251
|
+
{"on": bool, "schools": [{"name": ..., "entity_id": ...}, ...], "group": bool}."""
|
|
250
252
|
from . import school_switch
|
|
251
253
|
|
|
252
254
|
config = load_config()
|
|
253
|
-
count = len(school_switch.schools(config))
|
|
254
255
|
on = school_switch.enabled(config)
|
|
255
|
-
|
|
256
|
+
schools = [{"name": school_switch.name(entry), "entity_id": str(entry.get("idp_entity_id") or "").strip()}
|
|
257
|
+
for entry in school_switch.schools(config)] if on else []
|
|
258
|
+
return json.dumps({"on": on, "schools": schools, "group": on and len(schools) > 1}, ensure_ascii=False)
|
|
256
259
|
|
|
257
260
|
|
|
258
261
|
@mcp_app.tool()
|
|
@@ -334,9 +337,8 @@ def school_batch_papers(batch_id: str, folder: str, papers: list[dict[str, Any]]
|
|
|
334
337
|
doi, title, journal, state ("open": open access not checked yet, "school": waiting
|
|
335
338
|
for or in the institutional download, "ok", "failed"); a saved one adds via
|
|
336
339
|
(开放下载 or 机构下载), detail (出版社 API, Sci-Hub, 预印本) and path (the PDF,
|
|
337
|
-
absolute); a failed one cls (no_access, user_side,
|
|
338
|
-
|
|
339
|
-
and reason}]. folder: the batch's download folder (absolute); the window opens
|
|
340
|
+
absolute); a failed one cls (no_access, user_side, external, unsupported, unexplained; the
|
|
341
|
+
classes before 2026-11-22 are taken as these) and reason}]. folder: the batch's download folder (absolute); the window opens
|
|
340
342
|
a PDF only from inside it. Never touches the running download's progress.
|
|
341
343
|
"""
|
|
342
344
|
from . import progress_reporter
|
|
@@ -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.7.
|
|
7
|
+
version: "0.7.3"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# 文献检索与下载(paper-search)
|
|
@@ -86,17 +86,15 @@ SCHOOL_DATA_DIR="<数据目录>" paper-search-school preview --run-id "<本次 r
|
|
|
86
86
|
paper-search failures --format text
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
(默认最近一批;`--since YYYY-MM-DD`、`--runs N`、`--all
|
|
89
|
+
(默认最近一批;`--since YYYY-MM-DD`、`--runs N`、`--all`)。它把失败分成五类,每种原因有固定的说法(进度窗口、批量最后一行和汇总里都一样);向用户说明时用这些类名和说法,不另起说法:
|
|
90
90
|
|
|
91
|
-
| 类别 |
|
|
91
|
+
| 类别 | 说法(常见 code) | 怎么说、怎么做 |
|
|
92
92
|
| --- | --- | --- |
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
| 暂不支持的网站 | `unsupported_platform`(如只在 ClinicalKey 上的内容)、`unsupported_publisher`(DOI 没有指向能登录的出版社网站,没有打开浏览器)、`generic_institution_entry_missing`(这家出版社还没有专门的规则,按通用规则没找到机构登录入口) | 说明这类网站还不支持,不说成没有权限;后者可以建议用户把这篇报告给维护者补规则,或在校园网下下载。 |
|
|
99
|
-
| 原因不明(需排查) | `download_failed`、`download_timeout`、`login_not_reached`(程序没进入学校登录页)、`login_required`、`source_exception`、`browser_unresponsive`、`browser_connection_lost`(浏览器连接断了,批量已换新浏览器)、`pdf_identity_unverified`、`pdf_identity_mismatch`、`pdf_wrong_article` 等 | 不说成没有权限;说明原因待查,给出汇总里的“停在哪一步”和诊断文件位置。 |
|
|
93
|
+
| 没权限 | 学校没有订阅(`entitlement_missing`);出版社没开通本校(`institution_federation_unavailable`、`institution_not_registered`);你标记过没权限(`no_entitlement`);换过学校的写“N 所学校都没有权限” | 附上汇总里的依据(页面原话或决定性的一步)。只说本篇、这几所学校用不了,不推断整个平台;出版社没开通本校时不说成学校没有订阅,建议在校园网或学校 VPN 下下载。批量已在最后换过保存的其他学校。 |
|
|
94
|
+
| 要你处理 | 等你登录超时;你跳过或终止了;浏览器被关闭;浏览器被占用;密码被学校拒绝;账号被锁或密码过期 | 说明需要用户做什么(登录、等另一个任务结束、在设置里更新密码、按学校说明解锁),处理后说“接着下”;不连续重新提交登录。 |
|
|
95
|
+
| 外部原因 | 被网站拦截;出版社网站出错;学校登录系统出错;学校登录中途失效;网络中断;达到每小时下载上限;全文还没上线;DOI 查不到;网站没有学校登录 | 说明是对方的问题,不说成没有权限,也不说成程序出错;建议过会儿说“接着下”,或换网络、在校园网或学校 VPN 下下载。全文还没上线的等正式发表;DOI 查不到的过几天再试,一直查不到的请用户在出版社网站按标题自己下载;网站没有学校登录的,开放获取的文章到网站上直接下载。 |
|
|
96
|
+
| 暂不支持 | 只在其他平台提供;网站暂未适配;附录暂未适配 | 说明这个网站 PaperSearch 还没适配,不说成没有权限;给出汇总里的诊断文件和截图位置,建议用 `paper-search failures --export <文件.zip>` 导出记录发给维护者,急用可在校园网下自己下载。 |
|
|
97
|
+
| 原因不明 | 没取到 PDF;拿错 PDF;没法确认 PDF;页面或浏览器卡住;没进入学校登录页;文章页没存下来 | 不说成没有权限;批量已在最后用同一所学校再试过一次。说明原因待查,给出汇总里的“停在哪一步”和诊断文件位置。 |
|
|
100
98
|
|
|
101
99
|
`pdf_identity_unverified` / `pdf_identity_mismatch`:不能报成功,`review.path` 只是待核查的文件。
|
|
102
100
|
|
|
@@ -60,7 +60,7 @@ DOI 跳转到表外的网站时,程序按通用规则尝试:找机构登录
|
|
|
60
60
|
| 机构列表里没有 CARSI | AACR(aacrjournals.org) |
|
|
61
61
|
| 找不到机构登录入口(`generic_institution_entry_missing`) | Emerald(emerald.com) |
|
|
62
62
|
|
|
63
|
-
`generic_institution_entry_missing`
|
|
63
|
+
`generic_institution_entry_missing` 归“暂不支持”(说法“网站暂未适配”):告诉用户这类网站还没有规则,可以把这篇报告给维护者补规则,或在校园网下下载。
|
|
64
64
|
|
|
65
65
|
## 不支持的平台
|
|
66
66
|
|
|
@@ -70,7 +70,7 @@ DOI 跳转到表外的网站时,程序按通用规则尝试:找机构登录
|
|
|
70
70
|
|
|
71
71
|
这些结果说明的是“用户学校在这家出版社的情况”,不是程序故障:
|
|
72
72
|
|
|
73
|
-
- `institution_federation_unavailable
|
|
73
|
+
- `institution_federation_unavailable`:出版社的机构列表里找不到用户学校所属的联盟或这所学校,即这家出版社没开通本校路线。AMS(journals.ametsoc.org)只有会员登录、机构靠学校网络地址访问,也按这条结束。程序立即结束;建议在校园网或学校 VPN 下下载。
|
|
74
74
|
- `institution_not_registered`:学校的这个登录入口和这家出版社之间没有开通(出版社或学校的登录系统这样说),经这个入口没有权限,归入“没权限”;学校的其他入口、校园网或 VPN 可能仍可访问,不把它当作学校没有论文订阅。
|
|
75
75
|
- `idp_no_return_to_publisher`:学校登录后停在学校自己的网站,没回到出版社,通常也是学校没开通。
|
|
76
76
|
- `entitlement_missing`:出版社认出了学校,判定本篇不在订阅内。只说本篇、当前学校没有权限,不推断整个出版社。
|