papersearch 0.5.9 → 0.5.10

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 (35) hide show
  1. package/README.en.md +8 -8
  2. package/README.md +8 -8
  3. package/carsi/paper_search_carsi/adapters/base.py +5 -0
  4. package/carsi/paper_search_carsi/adapters/elsevier/__init__.py +28 -0
  5. package/carsi/paper_search_carsi/api_keys.py +10 -5
  6. package/carsi/paper_search_carsi/assets/api_keys.json +45 -15
  7. package/carsi/paper_search_carsi/assets/capsule.html +35 -18
  8. package/carsi/paper_search_carsi/assets/capsule_en.json +19 -5
  9. package/carsi/paper_search_carsi/engine/batch_institution.py +2 -0
  10. package/carsi/paper_search_carsi/progress_capsule.py +4 -10
  11. package/carsi/paper_search_carsi/progress_reporter.py +8 -4
  12. package/carsi/paper_search_carsi/progress_view.py +10 -2
  13. package/dist/capabilities/pdf-discovery/batch.js +3 -0
  14. package/dist/capabilities/pdf-discovery/batch.js.map +1 -1
  15. package/dist/capabilities/pdf-discovery/batchSummary.d.ts.map +1 -1
  16. package/dist/capabilities/pdf-discovery/batchSummary.js +14 -5
  17. package/dist/capabilities/pdf-discovery/batchSummary.js.map +1 -1
  18. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js +1 -1
  19. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js.map +1 -1
  20. package/dist/capabilities/pdf-discovery/carsi/types.d.ts +4 -1
  21. package/dist/capabilities/pdf-discovery/carsi/types.d.ts.map +1 -1
  22. package/dist/capabilities/pdf-discovery/handler.d.ts +6 -0
  23. package/dist/capabilities/pdf-discovery/handler.d.ts.map +1 -1
  24. package/dist/capabilities/pdf-discovery/handler.js +27 -2
  25. package/dist/capabilities/pdf-discovery/handler.js.map +1 -1
  26. package/dist/config/apiKeySignup.d.ts +8 -1
  27. package/dist/config/apiKeySignup.d.ts.map +1 -1
  28. package/dist/config/apiKeySignup.js +15 -2
  29. package/dist/config/apiKeySignup.js.map +1 -1
  30. package/dist/config/apiKeyTest.d.ts +1 -0
  31. package/dist/config/apiKeyTest.d.ts.map +1 -1
  32. package/dist/config/apiKeyTest.js +23 -5
  33. package/dist/config/apiKeyTest.js.map +1 -1
  34. package/package.json +1 -1
  35. package/skills/paper-search/references/browser-download.md +1 -1
package/README.en.md CHANGED
@@ -90,8 +90,6 @@ After "Start setup", your AI first asks whether you want school subscription dow
90
90
 
91
91
  Once set up, mention the PaperSearch Skill and say what you want to search for, for example:
92
92
 
93
- <p align="center"><img src="assets/ask-with-skill.png" width="645" alt="Mentioning the PaperSearch Skill in the message box: the request ends with a Paper Search tag"></p>
94
-
95
93
  | To do | You can say |
96
94
  |---|---|
97
95
  | Search papers | `/paper-search` Find randomized trials of SGLT2 inhibitors in heart failure since 2020, and verify the DOIs |
@@ -171,16 +169,17 @@ paper-search carsi status --format text # check that it is ready
171
169
 
172
170
  ### 2. API keys
173
171
 
174
- Keys fall into four groups by what they are for. Get the key you need and enter it any of the ways in [Quick start step 3](#3-add-api-keys-when-you-need-them).
172
+ Keys fall into four groups by what they are for. Get the key you need (an email needs no sign-up) and enter it any of the ways in [Quick start step 3](#3-add-api-keys-when-you-need-them).
175
173
 
176
- #### Journal metrics and full-text snippets (recommended)
174
+ #### Journal metrics, full-text snippets and free full texts (recommended)
177
175
 
178
176
  | Feature | Key | Where to get it |
179
177
  |---|---|---|
180
178
  | Look up impact factors and quartiles | `EASYSCHOLAR_KEY` | [EasyScholar](https://www.easyscholar.cc/) ([guide](https://docs.qq.com/aio/DTUxwZ3hUckVtZVJN), in Chinese) |
181
179
  | Search full-text snippets | `SEMANTIC_SCHOLAR_API_KEY` | [Semantic Scholar](https://www.semanticscholar.org/product/api) ([guide](https://docs.qq.com/aio/DTW9RdFVHc2hJUmpx), in Chinese) |
180
+ | Find free full texts when downloading | `PAPER_SEARCH_UNPAYWALL_EMAIL` | No sign-up ([Unpaywall: about](https://unpaywall.org/products/api)) |
182
181
 
183
- #### Subscribed full texts through publisher APIs (optional)
182
+ #### Subscribed full texts (optional)
184
183
 
185
184
  | Publisher | Key | Where to get it |
186
185
  |---|---|---|
@@ -196,16 +195,17 @@ Keys fall into four groups by what they are for. Get the key you need and enter
196
195
  | ScienceDirect, Scopus | `ELSEVIER_API_KEY` (the same key as above) | [Elsevier](https://dev.elsevier.com/apikey/manage) |
197
196
  | Springer | `SPRINGER_API_KEY` (the same key as above) | [Springer Nature](https://dev.springernature.com/) |
198
197
 
199
- #### Higher limits, steadier access (optional)
198
+ #### Faster, steadier search (optional)
200
199
 
201
200
  | Source | Key | Where to get it |
202
201
  |---|---|---|
202
+ | Crossref (search papers, check that DOIs are real) | `CROSSREF_MAILTO` | No sign-up ([about](https://www.crossref.org/documentation/retrieve-metadata/rest-api/tips-for-using-the-crossref-rest-api/)) |
203
203
  | PubMed | `PUBMED_API_KEY` | [NCBI](https://ncbiinsights.ncbi.nlm.nih.gov/2017/11/02/new-api-keys-for-the-e-utilities/) |
204
+ | OpenAlex (all citing papers past 10,000) | `OPENALEX_API_KEY` | [OpenAlex](https://openalex.org/settings/api) |
204
205
  | CORE | `CORE_API_KEY` | [CORE](https://core.ac.uk/services/api) |
205
206
  | OpenAIRE | `OPENAIRE_API_KEY` | [OpenAIRE](https://develop.openaire.eu/) |
206
- | OpenAlex (all citing papers past 10,000) | `OPENALEX_API_KEY` | [OpenAlex](https://openalex.org/settings/api) |
207
207
 
208
- Settings are saved in `~/.config/paper-search-cli/config.json`, readable only by you. The download folder, contact emails, proxy, automatic updates and other settings are in [Guide · Other settings](docs/guide.en.md#other-settings).
208
+ Settings are saved in `~/.config/paper-search-cli/config.json`, readable only by you. The download folder, proxy, automatic updates and other settings are in [Guide · Other settings](docs/guide.en.md#other-settings).
209
209
 
210
210
  ## More documentation
211
211
 
package/README.md CHANGED
@@ -90,8 +90,6 @@ AI 会先问你要不要装 PaperSearch 的命令行程序,你同意后装好
90
90
 
91
91
  配置好后,引用 PaperSearch 的 Skill,说出你需要搜索的内容,比如:
92
92
 
93
- <p align="center"><img src="assets/ask-with-skill.png" width="645" alt="在输入框里引用 PaperSearch 的 Skill:要做的事后面带着 Paper Search 标签"></p>
94
-
95
93
  | 想做什么 | 可以这样说 |
96
94
  |---|---|
97
95
  | 检索论文 | `/paper-search` 找 2020 年以来 SGLT2 抑制剂治疗心力衰竭的随机对照试验,核对 DOI |
@@ -171,16 +169,17 @@ paper-search carsi status --format text # 查看是否装好
171
169
 
172
170
  ### 2. API key
173
171
 
174
- 按用途分四类,需要哪类就申请对应的 key,再用[快速开始第 3 步](#3-按需填-api-key)里的任一方式填入。
172
+ 按用途分四类,需要哪类就申请对应的 key(邮箱直接填,不用申请),再用[快速开始第 3 步](#3-按需填-api-key)里的任一方式填入。
175
173
 
176
- #### 查期刊、搜正文(推荐配置)
174
+ #### 查期刊、搜正文、找免费全文(推荐配置)
177
175
 
178
176
  | 功能 | 要填的 key | 去哪里申请 |
179
177
  |---|---|---|
180
178
  | 查影响因子和分区 | `EASYSCHOLAR_KEY` | [EasyScholar](https://www.easyscholar.cc/)([申请教程](https://docs.qq.com/aio/DTUxwZ3hUckVtZVJN)) |
181
179
  | 搜正文片段 | `SEMANTIC_SCHOLAR_API_KEY` | [Semantic Scholar](https://www.semanticscholar.org/product/api)([申请教程](https://docs.qq.com/aio/DTW9RdFVHc2hJUmpx)) |
180
+ | 下载时找免费全文 | `PAPER_SEARCH_UNPAYWALL_EMAIL` | 不用申请([Unpaywall 说明](https://unpaywall.org/products/api)) |
182
181
 
183
- #### 下载订阅全文(出版社接口,非必须)
182
+ #### 下载订阅全文(非必须)
184
183
 
185
184
  | 出版社 | 要填的 key | 去哪里申请 |
186
185
  |---|---|---|
@@ -196,16 +195,17 @@ paper-search carsi status --format text # 查看是否装好
196
195
  | ScienceDirect、Scopus | `ELSEVIER_API_KEY`(和上面同一个) | [Elsevier](https://dev.elsevier.com/apikey/manage) |
197
196
  | Springer | `SPRINGER_API_KEY`(和上面同一个) | [Springer Nature](https://dev.springernature.com/) |
198
197
 
199
- #### 提高限额、更稳定(非必须)
198
+ #### 检索更快、更稳定(非必须)
200
199
 
201
200
  | 来源 | 要填的 key | 去哪里申请 |
202
201
  |---|---|---|
202
+ | Crossref(检索论文、核对 DOI 是否真实) | `CROSSREF_MAILTO` | 不用申请([说明](https://www.crossref.org/documentation/retrieve-metadata/rest-api/tips-for-using-the-crossref-rest-api/)) |
203
203
  | PubMed | `PUBMED_API_KEY` | [NCBI](https://ncbiinsights.ncbi.nlm.nih.gov/2017/11/02/new-api-keys-for-the-e-utilities/) |
204
+ | OpenAlex(被引超过 1 万篇时列全) | `OPENALEX_API_KEY` | [OpenAlex](https://openalex.org/settings/api) |
204
205
  | CORE | `CORE_API_KEY` | [CORE](https://core.ac.uk/services/api) |
205
206
  | OpenAIRE | `OPENAIRE_API_KEY` | [OpenAIRE](https://develop.openaire.eu/) |
206
- | OpenAlex(被引超过 1 万篇时列全) | `OPENALEX_API_KEY` | [OpenAlex](https://openalex.org/settings/api) |
207
207
 
208
- 配置保存在 `~/.config/paper-search-cli/config.json`,只有你自己能读。下载文件夹、联系邮箱、代理和自动更新等其他设置,见 [使用说明 · 其他设置](docs/guide.zh.md#其他设置)。
208
+ 配置保存在 `~/.config/paper-search-cli/config.json`,只有你自己能读。下载文件夹、代理和自动更新等其他设置,见 [使用说明 · 其他设置](docs/guide.zh.md#其他设置)。
209
209
 
210
210
  ## 更多文档
211
211
 
@@ -231,6 +231,11 @@ class PublisherAdapter:
231
231
  school is chosen (``choose_institution``) and nothing else is clicked."""
232
232
  return False
233
233
 
234
+ def leave_email_step(self, page: Any, result: Any) -> bool:
235
+ """The publisher's sign-in asks for the user's work email, not the school:
236
+ go back to its school search before anything is typed; True when clicked."""
237
+ return False
238
+
234
239
  def prepare_institution_choice(self, page: Any, result: Any) -> bool | None:
235
240
  """In the CARSI school choice, after the federation form and the school
236
241
  assistance, before the SeamlessAccess and publisher choosers: the
@@ -19,6 +19,7 @@ import re
19
19
  from typing import Any
20
20
  from urllib.parse import quote, urlparse
21
21
 
22
+ from ...browser.driver import is_driver_error
22
23
  from ...engine.router import elsevier_journal_article, extract_elsevier_pii
23
24
  from ..base import PublisherAdapter, SupplementLink, register
24
25
  from . import journal_site, sciencedirect
@@ -67,6 +68,20 @@ def supplement_links_from_rows(rows: Any, page_url: str, doi: str) -> list[Suppl
67
68
  # In CARSI mode only the generic chooser is used (never a remembered school's
68
69
  # InstitutionLogin shortcut); otherwise a remembered entry must name the
69
70
  # configured school.
71
+ # Elsevier ID's "Enter your organizational email" (Windows, 2026-11-11): the same
72
+ # #bdd-email field as "Find your organization", but for an email only; its
73
+ # "Access via another organization" leads back to the search by name.
74
+ _EMAIL_STEP_JS = """() => {
75
+ const shown = (el) => !!el && el.getClientRects().length > 0;
76
+ const field = document.querySelector("#bdd-email");
77
+ const label = (document.querySelector("#emaillabel") || {}).textContent || "";
78
+ const other = document.querySelector("#bdd-elsSecondaryBtn");
79
+ if (!shown(field) || !/e-?mail/i.test(label) || /name/i.test(label) || !shown(other)
80
+ || !/another organi[sz]ation/i.test(other.textContent || "")) return false;
81
+ other.click();
82
+ return true;
83
+ }"""
84
+
70
85
  _ENTRY_JS = """
71
86
  ({manualSelection, institutionQuery}) => {
72
87
  const visible = (el) => {
@@ -235,6 +250,19 @@ class ElsevierAdapter(PublisherAdapter):
235
250
  return True
236
251
  return False
237
252
 
253
+ def leave_email_step(self, page: Any, result: Any) -> bool:
254
+ if not self.is_institution_chooser(str(getattr(page, "url", "") or "")):
255
+ return False
256
+ try:
257
+ clicked = page.evaluate(_EMAIL_STEP_JS) is True
258
+ except Exception as exc:
259
+ if not is_driver_error(exc):
260
+ raise
261
+ return False # the page moved on while it was read
262
+ if clicked:
263
+ self.d._event(result, "elsevier_email_step_left", "Access via another organization")
264
+ return clicked
265
+
238
266
  def is_redirect_page(self, url: str) -> bool:
239
267
  # doi.org -> linkinghub "Redirecting" -> ScienceDirect, the journal's site or
240
268
  # ClinicalKey; and Elsevier ID's sign-in round trip a PDF request may take
@@ -21,6 +21,7 @@ from . import cli_config
21
21
  CATALOG = Path(__file__).resolve().parent / "assets" / "api_keys.json"
22
22
  MAX_LENGTH = 512
23
23
  _PRINTABLE = re.compile(r"^[\x21-\x7e]+$") # visible ASCII: no spaces, line breaks or full-width characters
24
+ _EMAIL = re.compile(r"^[^@\s]+@[^@\s]+\.[^@\s]+$")
24
25
 
25
26
 
26
27
  def groups() -> list[dict[str, Any]]:
@@ -48,10 +49,12 @@ def _status(service: dict[str, Any], config: dict) -> dict[str, Any]:
48
49
  keys = []
49
50
  for key in service["keys"]:
50
51
  value = str(config.get(key["key"]) or "").strip()
51
- keys.append({"key": key["key"], "label": key["label"], "set": bool(value), "masked": mask(value) if value else ""})
52
+ keys.append({"key": key["key"], "label": key["label"], "kind": key.get("kind", "key"),
53
+ "set": bool(value), "masked": mask(value) if value else ""})
52
54
  primary = keys[0]
53
55
  return {"id": service["id"], "name": service["name"], "use": service.get("use", ""), "url": service["url"],
54
56
  "guide": service.get("guide", ""), "guide_label": service.get("guide_label", ""),
57
+ "signup_label": service.get("signup_label", ""), "note": service.get("note", ""),
55
58
  "keys": keys, "set": primary["set"], "masked": primary["masked"]}
56
59
 
57
60
 
@@ -63,9 +66,11 @@ def listing() -> dict[str, Any]:
63
66
  return {"groups": shown, "filled": sum(1 for s in every if s["set"]), "total": len(every)}
64
67
 
65
68
 
66
- def check(value: str) -> tuple[str, str]:
67
- """A pasted value, trimmed, or why it cannot be a key."""
69
+ def check(value: str, kind: str = "key") -> tuple[str, str]:
70
+ """A pasted value, trimmed, or why it cannot be a key (an email for an email field)."""
68
71
  value = str(value or "").strip()
72
+ if kind == "email":
73
+ return (value, "") if not value or (len(value) <= 254 and _EMAIL.match(value)) else ("", "邮箱格式不对")
69
74
  if len(value) > MAX_LENGTH:
70
75
  return "", "太长了,请确认粘贴的是 key"
71
76
  if value and not _PRINTABLE.match(value):
@@ -91,11 +96,11 @@ def save(service_id: str, values: dict[str, str]) -> None:
91
96
  service = _service(service_id)
92
97
  changes: dict[str, str | None] = {}
93
98
  for key in service["keys"]:
94
- value, problem = check((values or {}).get(key["key"], ""))
99
+ value, problem = check((values or {}).get(key["key"], ""), key.get("kind", "key"))
95
100
  if problem:
96
101
  raise ValueError(problem)
97
102
  if not value:
98
- raise ValueError("请先粘贴 key;要删除请点“清除”")
103
+ raise ValueError("请先填写邮箱;要删除请点“清除”" if key.get("kind") == "email" else "请先粘贴 key;要删除请点“清除”")
99
104
  changes[key["key"]] = value
100
105
  cli_config.update(changes)
101
106
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "groups": [
3
3
  {
4
- "title": "查期刊、搜正文(推荐配置)",
4
+ "title": "查期刊、搜正文、找免费全文(推荐配置)",
5
5
  "services": [
6
6
  {
7
7
  "id": "easyscholar",
@@ -30,11 +30,26 @@
30
30
  "label": "API key"
31
31
  }
32
32
  ]
33
+ },
34
+ {
35
+ "id": "unpaywall",
36
+ "name": "Unpaywall",
37
+ "use": "下载时找免费全文",
38
+ "note": "填你常用的邮箱就行,不用注册",
39
+ "url": "https://unpaywall.org/products/api",
40
+ "signup_label": "说明",
41
+ "keys": [
42
+ {
43
+ "key": "PAPER_SEARCH_UNPAYWALL_EMAIL",
44
+ "label": "email",
45
+ "kind": "email"
46
+ }
47
+ ]
33
48
  }
34
49
  ]
35
50
  },
36
51
  {
37
- "title": "出版社接口(非必须)",
52
+ "title": "下载订阅全文(非必须)",
38
53
  "services": [
39
54
  {
40
55
  "id": "elsevier",
@@ -92,8 +107,23 @@
92
107
  ]
93
108
  },
94
109
  {
95
- "title": "提高限额(非必须)",
110
+ "title": "检索更快、更稳定(非必须)",
96
111
  "services": [
112
+ {
113
+ "id": "crossref",
114
+ "name": "Crossref",
115
+ "use": "检索论文、核对 DOI 是否真实",
116
+ "note": "填你常用的邮箱就行,不用注册",
117
+ "url": "https://www.crossref.org/documentation/retrieve-metadata/rest-api/tips-for-using-the-crossref-rest-api/",
118
+ "signup_label": "说明",
119
+ "keys": [
120
+ {
121
+ "key": "CROSSREF_MAILTO",
122
+ "label": "email",
123
+ "kind": "email"
124
+ }
125
+ ]
126
+ },
97
127
  {
98
128
  "id": "pubmed",
99
129
  "name": "PubMed",
@@ -106,6 +136,18 @@
106
136
  }
107
137
  ]
108
138
  },
139
+ {
140
+ "id": "openalex",
141
+ "name": "OpenAlex",
142
+ "use": "查引文的限额更高,被引过万也能列全",
143
+ "url": "https://openalex.org/settings/api",
144
+ "keys": [
145
+ {
146
+ "key": "OPENALEX_API_KEY",
147
+ "label": "API key"
148
+ }
149
+ ]
150
+ },
109
151
  {
110
152
  "id": "core",
111
153
  "name": "CORE",
@@ -129,18 +171,6 @@
129
171
  "label": "API key"
130
172
  }
131
173
  ]
132
- },
133
- {
134
- "id": "openalex",
135
- "name": "OpenAlex",
136
- "use": "查引文的限额更高,被引过万也能列全",
137
- "url": "https://openalex.org/settings/api",
138
- "keys": [
139
- {
140
- "key": "OPENALEX_API_KEY",
141
- "label": "API key"
142
- }
143
- ]
144
174
  }
145
175
  ]
146
176
  }
@@ -166,6 +166,7 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
166
166
  .key-row .btn { pointer-events: none; }
167
167
  .key-edit { background: var(--hover); border-radius: 8px; padding: 8px 10px; margin: 0 0 6px; }
168
168
  .settings .key-edit input { width: 100%; text-align: left; background: var(--bg); }
169
+ .key-note { font-size: 11px; line-height: 1.5; color: var(--dim); margin-bottom: 8px; }
169
170
  .key-edit .err { text-align: left; margin: 6px 0 0; }
170
171
  .key-edit .err:empty { display: none; }
171
172
  .key-edit .err.ok { color: var(--ok); }
@@ -202,6 +203,7 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
202
203
  .sec { margin-top: 14px; }
203
204
  .sec-h { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
204
205
  .sec-h b { color: var(--fg); font-weight: 600; font-size: 13px; }
206
+ .list-sub { margin-top: 10px; }
205
207
  .saved-line { font-size: 12px; color: var(--dim); line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
206
208
  .grp { border-top: 0.5px solid var(--line); padding: 8px 0; }
207
209
  .grp:last-child { border-bottom: 0.5px solid var(--line); }
@@ -216,7 +218,7 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
216
218
  .paper-list.scroll { -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent); mask-image: linear-gradient(to bottom, #000 80%, transparent); }
217
219
  .paper-list li { font-size: 12px; padding: 3px 0; }
218
220
  /* A list page scrolls as one, up to half the screen; its groups open in full inside it. */
219
- .papers-scroll { overflow-y: auto; overscroll-behavior: contain; }
221
+ .papers-scroll, .keys-scroll { overflow-y: auto; overscroll-behavior: contain; }
220
222
  .papers-scroll .paper-list { max-height: none; overflow: visible; }
221
223
  .paper-list .t, .paper-list .w { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
222
224
  .paper-list .w, .paper-list .more { color: var(--faint); }
@@ -522,11 +524,12 @@ function listRow(g, i) {
522
524
  return html + '<ul class="paper-list">'
523
525
  + g.papers.map((p) => {
524
526
  const lines = '<div class="t">' + esc(p.title) + "</div>" + (p.where ? '<div class="w">' + esc(p.where) + "</div>" : "");
525
- // A saved paper shows its PDF in its folder; a failed one opens its article page, to fetch it by hand.
527
+ // A saved paper shows its PDF in its folder; a failed one opens its article page, to fetch it by hand,
528
+ // and so does one still waiting (user, 2026-11-11).
526
529
  if (papersKind === "ok") {
527
530
  return '<li><button type="button" class="open-article" data-act="show_paper" data-index="' + p.index + '" title="打开所在文件夹">' + lines + "</button></li>";
528
531
  }
529
- if (papersKind === "failed" && p.doi) {
532
+ if ((papersKind === "failed" || papersKind === "left") && p.doi) {
530
533
  return '<li><button type="button" class="open-article" data-act="open_article" data-doi="' + esc(p.doi)
531
534
  + '" title="在浏览器打开这篇文章">' + lines + "</button></li>";
532
535
  }
@@ -535,6 +538,9 @@ function listRow(g, i) {
535
538
  + (g.more ? '<li class="more">另有 ' + g.more + " 篇未列出</li>" : "") + "</ul></div>";
536
539
  }
537
540
 
541
+ // A long list scrolls within half the screen at most, its title staying in place above it (user, 2026-11-10).
542
+ function listMaxHeight() { return Math.max(240, Math.round((screen.availHeight || 900) / 2) - 64); }
543
+
538
544
  function papersCard() {
539
545
  const list = shownList();
540
546
  const note = flash.text && Date.now() < flash.until ? flash.text : "";
@@ -542,10 +548,11 @@ function papersCard() {
542
548
  + '<div class="drag capsule-drag-region"><div class="text"><div class="title">' + LIST_TITLES[papersKind] + " " + list.count + " 篇</div></div></div></div>";
543
549
  if (note) html += '<div class="line">' + esc(note) + "</div>";
544
550
  if (!list.groups.length) html += '<div class="line">' + (papersList ? "没有论文" : "正在读取…") + "</div>";
545
- // Half the screen at most, the title staying in place above it (user, 2026-11-10).
546
- const most = Math.max(240, Math.round((screen.availHeight || 900) / 2) - 64);
547
- return html + '<div class="sec papers-scroll" style="max-height:' + most + 'px">'
548
- + list.groups.map((g, i) => listRow(g, i)).join("") + "</div></div>";
551
+ // Saved papers missing supplementary files follow the failed ones, as on the finished card (user, 2026-11-11).
552
+ const heading = (g, i) => g.supplement && !(list.groups[i - 1] || {}).supplement
553
+ ? '<div class="sec-h list-sub"><b>附录未下全 ' + (list.supplement_count || 0) + " 篇</b><span>正文已保存</span></div>" : "";
554
+ return html + '<div class="sec papers-scroll" style="max-height:' + listMaxHeight() + 'px">'
555
+ + list.groups.map((g, i) => heading(g, i) + listRow(g, i)).join("") + "</div></div>";
549
556
  }
550
557
 
551
558
  function idleCard() {
@@ -642,16 +649,19 @@ function keyRow(s) {
642
649
  + (s.set ? '<span class="key-set">' + esc(s.masked) + "</span>" : '<span class="dim" style="font-size:12px">未填</span>')
643
650
  + '</div><div class="key-edit">';
644
651
  // A saved key is in its field, hidden until the eye shows it.
652
+ // A contact email: what it is for above its field, and the field in plain text (user, 2026-11-11).
653
+ const emails = s.keys.every((k) => k.kind === "email");
654
+ if (s.note) html += '<div class="key-note">' + esc(s.note) + "</div>";
645
655
  for (const k of s.keys) {
646
- html += '<input id="key-' + esc(k.key) + '" data-key="' + esc(k.key) + '" type="' + (revealed ? "text" : "password")
656
+ html += '<input id="key-' + esc(k.key) + '" data-key="' + esc(k.key) + '" type="' + (revealed || k.kind === "email" ? "text" : "password")
647
657
  + '" value="' + esc(editValues[k.key] || "") + '" autocomplete="off" spellcheck="false" aria-label="' + esc(s.name + " " + k.label)
648
- + '" placeholder="粘贴 key">';
658
+ + '" placeholder="' + (k.kind === "email" ? "填你常用的邮箱" : "粘贴 key") + '">';
649
659
  }
650
660
  return html + '<div class="key-links">'
651
- + '<button class="btn link" data-act="signup" data-service="' + esc(s.id) + '">去申请' + icon("external") + "</button>"
661
+ + '<button class="btn link" data-act="signup" data-service="' + esc(s.id) + '">' + esc(s.signup_label || "去申请") + icon("external") + "</button>"
652
662
  + (s.guide ? '<button class="btn link" data-act="guide" data-service="' + esc(s.id) + '">' + esc(s.guide_label || "教程") + icon("external") + "</button>" : "")
653
663
  + '<span class="grow"></span>'
654
- + '<button class="iconbtn" data-act="reveal" aria-label="显示 key" aria-pressed="' + revealed + '">' + icon("eye") + "</button></div>"
664
+ + (emails ? "" : '<button class="iconbtn" data-act="reveal" aria-label="显示 key" aria-pressed="' + revealed + '">' + icon("eye") + "</button>") + "</div>"
655
665
  + '<div class="err" id="key-error" role="status"></div><div class="key-actions">'
656
666
  + '<button class="btn" data-act="test_key" data-service="' + esc(s.id) + '">测试</button><span class="grow"></span>'
657
667
  + (s.set ? '<button class="btn danger" data-act="clear_key" data-service="' + esc(s.id) + '">清除</button>' : "")
@@ -662,10 +672,10 @@ function keyRow(s) {
662
672
  function settingsKeys() {
663
673
  let html = settingsHead("API key");
664
674
  if (!apiKeys || !apiKeys.ok) return html + '<div class="err" style="text-align:left">' + esc((apiKeys && apiKeys.error) || "读取配置失败") + "</div>";
665
- for (const group of apiKeys.groups) {
666
- html += '<div class="key-group">' + esc(group.title) + "</div>" + group.services.map(keyRow).join("");
667
- }
668
- return html;
675
+ // Twelve services and an opened one's editor: a list of their own (user, 2026-11-11).
676
+ return html + '<div class="keys-scroll" style="max-height:' + listMaxHeight() + 'px">'
677
+ + apiKeys.groups.map((group) => '<div class="key-group">' + esc(group.title) + "</div>" + group.services.map(keyRow).join("")).join("")
678
+ + "</div>";
669
679
  }
670
680
 
671
681
  function settingsCard() {
@@ -770,7 +780,7 @@ function keyError(text, tone) {
770
780
  if (line) { line.textContent = tr(text); line.className = "err" + (tone ? " " + tone : ""); }
771
781
  }
772
782
 
773
- let lastCls = "", hovering = false, closing = false, dragging = false, endingDrag = false;
783
+ let lastCls = "", lastPlace = "", hovering = false, closing = false, dragging = false, endingDrag = false;
774
784
  let dragReady = Promise.resolve();
775
785
  let attentionPointer = null;
776
786
  let renderedAttention = null;
@@ -808,8 +818,14 @@ function render(force) {
808
818
  root.style.width = ""; root.style.height = "";
809
819
  root.style.removeProperty("--content-max-height");
810
820
  if (!unchanged) {
821
+ // A scrolled list keeps its place while its page is redrawn (a key opened or saved, a group opened).
822
+ const place = panel + ":" + (panel === "settings" ? settingsPage : papersKind);
823
+ const scrolled = place === lastPlace ? root.querySelector(".papers-scroll, .keys-scroll")?.scrollTop || 0 : 0;
824
+ lastPlace = place;
811
825
  root.className = cls + " capsule-drag-region" + (cls !== lastCls ? " fade" : "");
812
826
  root.innerHTML = '<div class="surface">' + html + "</div>";
827
+ const list = root.querySelector(".papers-scroll, .keys-scroll");
828
+ if (list) list.scrollTop = scrolled;
813
829
  localize(root);
814
830
  if (attention) updateAttentionCountdown();
815
831
  renderedAttention = attention ? V : null;
@@ -949,7 +965,8 @@ async function act(action, target) {
949
965
  case "edit_key":
950
966
  editValues = await savedValues(target.dataset.service);
951
967
  editing = target.dataset.service; confirmClear = ""; revealed = false; render(true);
952
- return root.querySelector(".key-edit input")?.focus();
968
+ root.querySelector(".key-edit")?.scrollIntoView({ block: "nearest" });
969
+ return root.querySelector(".key-edit input")?.focus({ preventScroll: true });
953
970
  case "cancel_key": editing = ""; editValues = {}; confirmClear = ""; return render(true);
954
971
  case "reveal":
955
972
  revealed = !revealed;
@@ -1037,7 +1054,7 @@ async function act(action, target) {
1037
1054
  }
1038
1055
 
1039
1056
  // A paper list scrolls; pressing in it must not drag the window.
1040
- const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"], .paper-list, .papers-scroll');
1057
+ const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"], .paper-list, .papers-scroll, .keys-scroll');
1041
1058
  root.addEventListener("pointerdown", (event) => {
1042
1059
  if (event.button === 0 && api().activate_on_input) inputActivation = api().activate_on_input();
1043
1060
  if (event.button === 0 && event.target.closest(".attention-target")) {
@@ -195,10 +195,7 @@
195
195
  "每家出版社每小时最多": "Per publisher per hour",
196
196
  "秒": "s",
197
197
  "篇": "papers",
198
- "查期刊、搜正文(推荐配置)": "Journals & snippets (recommended)",
199
- "出版社接口(非必须)": "Publisher APIs (optional)",
200
198
  "增加检索来源(非必须)": "More sources (optional)",
201
- "提高限额(非必须)": "Higher limits (optional)",
202
199
  "查影响因子和分区": "Impact factor & rank",
203
200
  "搜正文片段": "Full-text snippets",
204
201
  "下载全文,检索 ScienceDirect、Scopus": "Full text; search ScienceDirect, Scopus",
@@ -248,7 +245,6 @@
248
245
  "没有论文": "No papers",
249
246
  "正在读取…": "Loading…",
250
247
  "打开失败:没有这篇的 PDF": "Couldn't open: no PDF saved",
251
- "打开失败:PDF 不在这批的下载文件夹里": "Couldn't open: PDF outside the batch folder",
252
248
  "打开失败:文件已被移走或删除": "Couldn't open: file moved or deleted",
253
249
  "打开所在文件夹": "Show in folder",
254
250
  "已打开所在文件夹": "Shown in its folder",
@@ -270,7 +266,21 @@
270
266
  "测试通知没有发出:这台电脑不发系统通知": "Test not sent: no system notifications here",
271
267
  "✓ 已发出,右上角应弹出一条通知": "✓ Sent; see the top right",
272
268
  "✓ 已发出,右下角应弹出一条通知": "✓ Sent; see the bottom right",
273
- "改好后再点一次“测试”": "Then press Test again"
269
+ "改好后再点一次“测试”": "Then press Test again",
270
+ "说明": "About",
271
+ "邮箱格式不对": "Not an email address",
272
+ "请先填写邮箱;要删除请点“清除”": "Enter an email first; Clear removes it",
273
+ "填你常用的邮箱": "Your usual email",
274
+ "可以用:Unpaywall 接受这个邮箱": "Works: Unpaywall takes it",
275
+ "被拒绝:Unpaywall 不接受这个邮箱,请填你自己常用的邮箱": "Rejected by Unpaywall: use your own email",
276
+ "可以用:已走 Crossref 优先通道": "Works: Crossref polite pool",
277
+ "Crossref 没有认这个邮箱,仍走普通通道": "Crossref didn't take it: public pool",
278
+ "查期刊、搜正文、找免费全文(推荐配置)": "Journals, snippets, free texts (recommended)",
279
+ "下载订阅全文(非必须)": "Subscribed texts (optional)",
280
+ "检索更快、更稳定(非必须)": "Faster, steady search (optional)",
281
+ "下载时找免费全文": "Finds free full texts",
282
+ "检索论文、核对 DOI 是否真实": "Search papers; check DOIs are real",
283
+ "填你常用的邮箱就行,不用注册": "Your usual email will do; no sign-up"
274
284
  },
275
285
  "patterns": [
276
286
  [
@@ -433,6 +443,10 @@
433
443
  "^被拒绝:key 不对,或已失效((.+))$",
434
444
  "Rejected: wrong or expired key ($1)"
435
445
  ],
446
+ [
447
+ "^被拒绝:Unpaywall 不接受这个邮箱,请填你自己常用的邮箱((.+))$",
448
+ "Rejected by Unpaywall: use your own email ($1)"
449
+ ],
436
450
  [
437
451
  "^服务器限流,稍后再试;key 本身可能没问题((.+))$",
438
452
  "Rate-limited; try later ($1)"
@@ -71,6 +71,8 @@ class InstitutionMixin:
71
71
  def _select_institution(self, page: Any, result: DownloadResult) -> bool:
72
72
  if getattr(self, "_manual_school", False):
73
73
  return False # the user reported a wrong school: they choose it in the window
74
+ if self.adapter.leave_email_step(page, result):
75
+ return True # an email field takes no school name (Elsevier ID, 2026-11-11)
74
76
  if self.config.get("publisher_institution_federation") == "carsi":
75
77
  if self._has_publisher_institution_session(page):
76
78
  # The publisher already shows a signed-in school: nothing to choose
@@ -303,21 +303,15 @@ class Api:
303
303
  return progress_view.paper_lists(read_papers(), read_state())
304
304
 
305
305
  def show_paper(self, index: int) -> str:
306
- """A saved PDF of the running or finished batch, shown in its folder; only inside the batch's folder."""
306
+ """A saved PDF of the running or finished batch, shown in its folder: the path the batch
307
+ recorded for it, wherever the paper was sent (folders of their own by topic, user 2026-11-11)."""
307
308
  listed, state = read_papers() or {}, read_state() or {}
308
309
  key = str(index) if isinstance(index, int) and not isinstance(index, bool) else ""
309
310
  paper = (listed.get("papers") or {}).get(key) if listed.get("batch_id") == state.get("batch_id") else None
310
311
  path = str((paper or {}).get("path") or "") if (paper or {}).get("state") == "ok" else ""
311
- folder = str(listed.get("folder") or "")
312
- if not path or not folder:
312
+ real = os.path.realpath(path) if path else ""
313
+ if not real.lower().endswith(".pdf"):
313
314
  return "打开失败:没有这篇的 PDF"
314
- real, base = os.path.realpath(path), os.path.realpath(folder)
315
- try:
316
- inside = os.path.commonpath([real, base]) == base
317
- except ValueError: # another drive (Windows)
318
- inside = False
319
- if not inside or not real.lower().endswith(".pdf"):
320
- return "打开失败:PDF 不在这批的下载文件夹里"
321
315
  if not progress_view.reveal_file(real):
322
316
  return "打开失败:文件已被移走或删除"
323
317
  return "已打开所在文件夹"
@@ -482,6 +482,9 @@ def _paper(raw: Any) -> dict[str, Any] | None:
482
482
  path = raw.get("path")
483
483
  if isinstance(path, str) and 0 < len(path) <= 4096 and os.path.isabs(path):
484
484
  paper["path"] = path
485
+ if raw.get("supplement_reason"): # saved, but not every supplementary file
486
+ paper.update(supplement_cls=raw.get("supplement_cls") if raw.get("supplement_cls") in FAILURE_CLASSES
487
+ else "unexplained", supplement_reason=_display_text(raw.get("supplement_reason")))
485
488
  elif paper["state"] == "failed":
486
489
  paper.update(cls=raw.get("cls") if raw.get("cls") in FAILURE_CLASSES else "unexplained",
487
490
  reason=_display_text(raw.get("reason")))
@@ -496,10 +499,11 @@ def sync_papers(batch_id: str, folder: str, papers: Any) -> bool:
496
499
  (``PAPER_STATES``). Another batch starts a new list. Wire shape of a paper:
497
500
  ``index``, ``doi``, ``title``, ``journal``, ``state``; a saved one adds ``via``
498
501
  (开放下载 or 机构下载), ``detail`` (the open source when not open access: 出版社 API,
499
- Sci-Hub, 预印本) and ``path`` (the PDF, absolute); a failed one ``cls`` (one of
500
- FAILURE_CLASSES) and ``reason``. ``folder`` is the batch's download folder: the
501
- window opens a PDF only from inside it. Kept apart from the progress file, which
502
- the downloading process rewrites every moment."""
502
+ Sci-Hub, 预印本), ``path`` (the PDF, absolute, wherever the paper was sent) and,
503
+ missing supplementary files, ``supplement_cls`` and ``supplement_reason``; a failed
504
+ one ``cls`` (one of FAILURE_CLASSES) and ``reason``. ``folder`` is the batch's
505
+ download folder. Kept apart from the progress file, which the downloading process
506
+ rewrites every moment."""
503
507
  if not isinstance(batch_id, str) or not 0 < len(batch_id) <= 128 or not isinstance(papers, list):
504
508
  return False
505
509
  with _PAPERS_LOCK:
@@ -222,7 +222,8 @@ def paper_lists(listed: Any, state: dict[str, Any] | None) -> dict[str, Any]:
222
222
 
223
223
  ``ok``: by the way each came (开放下载, its sources in brackets; 机构下载), a paper
224
224
  opening its PDF by ``index``; ``failed``: by reason as on the finished card, a paper
225
- opening its article page; ``left``: the paper being downloaded, those waiting for the
225
+ opening its article page, then the saved papers missing supplementary files, by reason
226
+ (``supplement`` groups; ``count`` the failed papers only, ``supplement_count`` these); ``left``: the paper being downloaded, those waiting for the
226
227
  institutional download and those open access has not checked yet. Each list has its
227
228
  ``count`` and groups, the first one open. Empty for another batch's papers."""
228
229
  if not isinstance(listed, dict) or not state or listed.get("batch_id") != state.get("batch_id"):
@@ -263,6 +264,11 @@ def paper_lists(listed: Any, state: dict[str, Any] | None) -> dict[str, Any]:
263
264
  failed = _reason_groups([{**p, "note": ""} for p in papers if p.get("state") == "failed"], 0)
264
265
  for item in failed:
265
266
  item.update(label=item["reason"])
267
+ # As on the finished card, while the batch runs too (user, 2026-11-11).
268
+ short = _reason_groups([{**p, "cls": p["supplement_cls"], "reason": p["supplement_reason"], "note": ""}
269
+ for p in papers if p.get("state") == "ok" and p.get("supplement_reason")], 0)
270
+ for item in short:
271
+ item.update(label=item["reason"], supplement=True)
266
272
 
267
273
  waiting: dict[str, list[dict[str, Any]]] = {key: [] for key, _ in LEFT_GROUPS}
268
274
  for paper in papers:
@@ -272,7 +278,9 @@ def paper_lists(listed: Any, state: dict[str, Any] | None) -> dict[str, Any]:
272
278
  way = "机构下载" if paper["state"] == "school" else OPEN_DOWNLOAD
273
279
  waiting["now" if now else paper["state"]].append(row(paper, paper.get("journal"), way if now else ""))
274
280
  left = [group(label, waiting[key]) for key, label in LEFT_GROUPS if waiting[key]]
275
- return {"ok": first_open(saved), "failed": first_open(failed), "left": first_open(left)}
281
+ missing = first_open(failed + short)
282
+ missing.update(count=sum(item["count"] for item in failed), supplement_count=sum(item["count"] for item in short))
283
+ return {"ok": first_open(saved), "failed": missing, "left": first_open(left)}
276
284
 
277
285
 
278
286
  def view(state: dict[str, Any] | None, now: float) -> dict[str, Any]:
@@ -595,6 +595,9 @@ async function downloadTwoPhase(searchers, options, backend, log, createTiers, m
595
595
  supplementsFailed += 1;
596
596
  }
597
597
  record(offset);
598
+ // The window's 失败 list shows a missing supplementary file as it happens (user, 2026-11-11).
599
+ settle(offset);
600
+ await sendPapers();
598
601
  if (stoppedByUser(items[offset])) {
599
602
  for (const rest of open.slice(step + 1)) {
600
603
  items[rest].supplements = [{ status: "skipped", label: "", reason: "batch_stopped" }];