papersearch 0.6.2 → 0.6.4

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 (37) hide show
  1. package/README.en.md +12 -20
  2. package/README.md +12 -20
  3. package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.d.ts.map +1 -1
  4. package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.js +6 -2
  5. package/dist/capabilities/pdf-discovery/school/SchoolMcpClient.js.map +1 -1
  6. package/dist/infrastructure/pdf/PdfIdentity.d.ts.map +1 -1
  7. package/dist/infrastructure/pdf/PdfIdentity.js +27 -6
  8. package/dist/infrastructure/pdf/PdfIdentity.js.map +1 -1
  9. package/package.json +1 -1
  10. package/school/paper_search_school/adapters/base.py +3 -2
  11. package/school/paper_search_school/adapters/elsevier/__init__.py +46 -0
  12. package/school/paper_search_school/assets/capsule.html +25 -12
  13. package/school/paper_search_school/assets/capsule_en.json +6 -6
  14. package/school/paper_search_school/browser/batch_session.py +65 -5
  15. package/school/paper_search_school/engine/batch_institution.py +99 -5
  16. package/school/paper_search_school/engine/batch_login.py +18 -5
  17. package/school/paper_search_school/engine/bridge.py +2 -2
  18. package/school/paper_search_school/engine/pdf_guard.py +28 -7
  19. package/school/paper_search_school/federations/builtin/azsciencenet.json +11 -0
  20. package/school/paper_search_school/federations/builtin/belnet.json +11 -0
  21. package/school/paper_search_school/federations/builtin/cstcloud.json +11 -0
  22. package/school/paper_search_school/federations/builtin/cynet.json +11 -0
  23. package/school/paper_search_school/federations/builtin/edugate.json +11 -0
  24. package/school/paper_search_school/federations/builtin/eduidlu.json +11 -0
  25. package/school/paper_search_school/federations/builtin/irfed.json +11 -0
  26. package/school/paper_search_school/federations/builtin/iucc.json +11 -0
  27. package/school/paper_search_school/federations/builtin/maeen.json +11 -0
  28. package/school/paper_search_school/federations/builtin/renater.json +11 -0
  29. package/school/paper_search_school/federations/builtin/surfconext.json +11 -0
  30. package/school/paper_search_school/federations/builtin/ukfederation.json +11 -0
  31. package/school/paper_search_school/federations/schools.py +68 -14
  32. package/school/paper_search_school/progress_view.py +11 -5
  33. package/school/paper_search_school/rate_limit.py +30 -16
  34. package/school/paper_search_school/server.py +2 -1
  35. package/skills/paper-search/SKILL.md +1 -1
  36. package/skills/paper-search/references/federation-support.md +84 -11
  37. package/skills/paper-search/references/school-setup.md +3 -2
@@ -0,0 +1,11 @@
1
+ {
2
+ "code": "iucc",
3
+ "name": "IUCC",
4
+ "country": "IL",
5
+ "registration_authorities": ["http://iif.iucc.ac.il"],
6
+ "chooser_labels": ["IUCC Identity Federation"],
7
+ "chooser_pattern": "\\bIUCC\\b",
8
+ "discovery_hosts": [],
9
+ "service_domains": ["iif.iucc.ac.il"],
10
+ "metadata_url": "https://iif-ng.iucc.ac.il/md/iif-ng.xml"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "code": "maeen",
3
+ "name": "Maeen",
4
+ "country": "SA",
5
+ "registration_authorities": ["https://www.maeen.sa"],
6
+ "chooser_labels": ["Maeen Identity Federation"],
7
+ "chooser_pattern": "\\bMaeen\\b",
8
+ "discovery_hosts": [],
9
+ "service_domains": ["maeen.sa"],
10
+ "metadata_url": "https://md.maeen.sa/metadata/maeen-edugain-metadata.xml"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "code": "renater",
3
+ "name": "RENATER",
4
+ "country": "FR",
5
+ "registration_authorities": ["https://federation.renater.fr/"],
6
+ "chooser_labels": ["Fédération Éducation-Recherche (Renater)"],
7
+ "chooser_pattern": "\\bRENATER\\b|\\bF[ée]d[ée]ration\\s+[ÉE]ducation[- ]Recherche\\b",
8
+ "discovery_hosts": [],
9
+ "service_domains": ["federation.renater.fr"],
10
+ "metadata_url": "https://pub.federation.renater.fr/metadata/edugain-upstream/renater-edugain-upstream-metadata.xml"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "code": "surfconext",
3
+ "name": "SURFconext",
4
+ "country": "NL",
5
+ "registration_authorities": ["http://www.surfconext.nl/"],
6
+ "chooser_labels": ["SURFconext"],
7
+ "chooser_pattern": "\\bSURFconext\\b",
8
+ "discovery_hosts": [],
9
+ "service_domains": ["surfconext.nl"],
10
+ "metadata_url": "https://metadata.surfconext.nl/signed/2023/edugain-upstream.xml"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "code": "ukfederation",
3
+ "name": "UK federation",
4
+ "country": "GB",
5
+ "registration_authorities": ["http://ukfederation.org.uk"],
6
+ "chooser_labels": ["UK Higher Education", "UK Access Management Federation", "UK federation (United Kingdom)"],
7
+ "chooser_pattern": "\\bUK\\s+(?:Access\\s+Management\\s+)?Federation\\b|\\bUK\\s+Higher\\s+Education\\b",
8
+ "discovery_hosts": [],
9
+ "service_domains": ["ukfederation.org.uk"],
10
+ "metadata_url": "http://metadata.ukfederation.org.uk/ukfederation-export.xml"
11
+ }
@@ -21,8 +21,9 @@ from __future__ import annotations
21
21
  import hashlib
22
22
  import re
23
23
  import time
24
+ import unicodedata
24
25
  import xml.etree.ElementTree as ET
25
- from dataclasses import dataclass, field
26
+ from dataclasses import dataclass, field, replace
26
27
  from pathlib import Path
27
28
  from typing import Any, Iterable
28
29
  from urllib.parse import quote, urlparse
@@ -154,10 +155,16 @@ def institutional_configured(config: dict[str, Any]) -> bool:
154
155
 
155
156
  # --------------------------------------------------------------------------- finding
156
157
 
158
+ def _plain(text: str) -> str:
159
+ """Accents on Latin and Greek letters do not count ("Universite" listed for
160
+ "Université", 2026-11-13); other scripts' marks (Japanese voicing) stay."""
161
+ return unicodedata.normalize("NFC", re.sub(r"[\u0300-\u036f]", "", unicodedata.normalize("NFD", str(text or ""))))
162
+
163
+
157
164
  def _key(text: str) -> str:
158
- """Case, spaces, hyphens, punctuation and a leading "The" do not count; "&"
159
- is "and" (a school listed as "Science & Technology", 2026-11-12)."""
160
- text = re.sub(r"^the\s+", "", str(text or "").casefold().strip())
165
+ """Case, spaces, hyphens, punctuation, accents and a leading "The" do not
166
+ count; "&" is "and" (a school listed as "Science & Technology", 2026-11-12)."""
167
+ text = re.sub(r"^the\s+", "", _plain(text).casefold().strip())
161
168
  return re.sub(r"[\W_]+", "", text.replace("&", " and "))
162
169
 
163
170
 
@@ -175,8 +182,12 @@ class _Found:
175
182
 
176
183
  def __init__(self) -> None:
177
184
  self.rows: dict[str, tuple[School, bool]] = {}
185
+ # The entries found by one of their names, not only by a domain or entityID.
186
+ self.named: set[str] = set()
178
187
 
179
- def add(self, school: School, exact: bool) -> None:
188
+ def add(self, school: School, exact: bool, named: bool = True) -> None:
189
+ if named:
190
+ self.named.add(school.entity_id)
180
191
  known = self.rows.get(school.entity_id)
181
192
  if known is None or (exact and not known[1]):
182
193
  self.rows[school.entity_id] = (school, exact)
@@ -195,6 +206,8 @@ class _Found:
195
206
  matches a campus in CARSI, the school itself is listed in English)."""
196
207
  self._primary()
197
208
  exact = [s for s, e in self.rows.values() if e]
209
+ if len(exact) > 1:
210
+ exact = [_one_school(exact)] if _one_school(exact) else exact
198
211
  if len(exact) == 1:
199
212
  return exact[0], []
200
213
  if exact:
@@ -217,6 +230,17 @@ def _same_school(other: School, school: School) -> bool:
217
230
  return bool({d.rsplit(".", 1)[-1] for d in other.scopes} & {d.rsplit(".", 1)[-1] for d in school.scopes})
218
231
 
219
232
 
233
+ def _one_school(schools: list[School]) -> School | None:
234
+ """One school listed several times in one federation under a domain of its own
235
+ (a second login server, an alumni-only one: 2026-11-13): its entry with the
236
+ plainest name, the one the others' names contain. A shared entry (a national
237
+ one covering the school's domain) has another name and keeps them apart."""
238
+ if len({s.federation for s in schools}) != 1 or not set.intersection(*(set(s.scopes) for s in schools)):
239
+ return None
240
+ plain = min(schools, key=lambda s: (len(s.name), s.name))
241
+ return plain if all(_key(plain.name) in _key(s.name) for s in schools) else None
242
+
243
+
220
244
  def _secondary(school: School) -> bool:
221
245
  federation = by_code(school.federation)
222
246
  return bool(federation and federation.secondary)
@@ -229,6 +253,9 @@ _RETIRED = re.compile(r"\bdo not use\b|\btest\b|\blegacy\b", re.I)
229
253
  _PARTS = re.compile(r"\s+[-\u2013\u2014]\s+")
230
254
  _BRACKET = re.compile(r"\(([^()]+)\)")
231
255
  # Chinese, Japanese and Korean writing, beside a name in Latin letters.
256
+ # A word naming the login server, not the school, at the end of a listed name
257
+ # ("<School> IdP", 2026-11-13).
258
+ _SERVER_WORD = re.compile(r"\s+(?:IdP|Identity\s+Provider|SSO)$", re.I)
232
259
  _CJK = re.compile(r"[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af][\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\s・·]*")
233
260
 
234
261
 
@@ -237,14 +264,15 @@ def _names(titles: Iterable[str]) -> list[str]:
237
264
  Harbour University" (an abbreviation before the name), "北大学 (Kita
238
265
  University) – OpenAthens" (a second name in brackets, the route after a dash),
239
266
  "National Harbour Bay University (NHBU) 海灣大學" (brackets inside, and a name in
240
- another script beside the English one: OpenAthens in Taiwan, 2026-11-12)."""
267
+ another script beside the English one: OpenAthens in Taiwan, 2026-11-12),
268
+ "Harbour University IdP" (the login server's word after the name)."""
241
269
  names = [str(t).strip() for t in titles if str(t or "").strip()]
242
270
  found = list(names)
243
271
  for name in names:
244
272
  for part in _PARTS.split(name):
245
273
  part = part.strip()
246
274
  outside = re.sub(r"\s+", " ", _BRACKET.sub(" ", part)).strip()
247
- found += [part, outside, *(m.strip() for m in _BRACKET.findall(part))]
275
+ found += [part, outside, _SERVER_WORD.sub("", outside), *(m.strip() for m in _BRACKET.findall(part))]
248
276
  if _CJK.search(outside) and re.search(r"[A-Za-z]{2}", _CJK.sub(" ", outside)):
249
277
  found += [m.strip() for m in _CJK.findall(outside)] + [re.sub(r"\s+", " ", _CJK.sub(" ", outside)).strip()]
250
278
  return list(dict.fromkeys(n for n in found if n))
@@ -252,7 +280,7 @@ def _names(titles: Iterable[str]) -> list[str]:
252
280
 
253
281
  def _words(text: str) -> list[str]:
254
282
  """The words of a name, as ``_key`` compares them."""
255
- words = [w for w in re.split(r"[\W_]+", str(text or "").casefold().replace("&", " and ")) if w]
283
+ words = [w for w in re.split(r"[\W_]+", _plain(text).casefold().replace("&", " and ")) if w]
256
284
  return words[1:] if words[:1] == ["the"] else words
257
285
 
258
286
 
@@ -315,7 +343,9 @@ def _seamlessaccess(text: str, config: dict[str, Any]) -> list[dict[str, Any]]:
315
343
 
316
344
  def _from_seamlessaccess(given: list[str], config: dict[str, Any], found: _Found, lookup: Lookup,
317
345
  carsi_listed: bool) -> None:
318
- for text in given:
346
+ # Its search keeps accents: a name given with them is also searched without
347
+ # ("Université" listed as "Universite", 2026-11-13).
348
+ for text in dict.fromkeys([*given, *(_plain(t) for t in given)]):
319
349
  try:
320
350
  rows = _seamlessaccess(text, config)
321
351
  except Exception:
@@ -341,9 +371,13 @@ def _from_seamlessaccess(given: list[str], config: dict[str, Any], found: _Found
341
371
  continue
342
372
  if federation.member_list == "carsi" and carsi_listed:
343
373
  continue # CARSI's own list is the source for its schools
344
- english = str((row.get("title_langs") or {}).get("en") or title)
345
- found.add(School(english, english, entity, federation.code, scopes[0] if scopes else "",
346
- scopes=tuple(scopes)), exact)
374
+ english = _SERVER_WORD.sub("", str((row.get("title_langs") or {}).get("en") or title)).strip()
375
+ # The name in the school's own language when that is the one given: publishers
376
+ # may list it so (a French name searched in English found nothing, 2026-11-13).
377
+ local = next((str(v) for k, v in (row.get("title_langs") or {}).items()
378
+ if k != "en" and any(_key(t) == _key(v) for t in given)), english)
379
+ found.add(School(local, english, entity, federation.code, scopes[0] if scopes else "",
380
+ scopes=tuple(scopes)), exact, named=_named(given, titles))
347
381
 
348
382
 
349
383
  def _metadata(federation: Federation, config: dict[str, Any], data_dir: Path) -> ET.Element:
@@ -373,7 +407,7 @@ def _metadata_schools(federation: Federation, root: ET.Element) -> list[tuple[Sc
373
407
  for n in idp.findall("md:Extensions/mdui:UIInfo/mdui:DisplayName", _NS)}
374
408
  organization = [(n.text or "").strip() for n in entity.findall("md:Organization/md:OrganizationDisplayName", _NS)]
375
409
  listed = _names([*display.values(), *organization])
376
- english = display.get("en") or (organization[0] if organization else entity_id)
410
+ english = _SERVER_WORD.sub("", display.get("en") or (organization[0] if organization else entity_id)).strip()
377
411
  if _RETIRED.search(english):
378
412
  continue
379
413
  scopes = [(s.text or "").strip().lower() for s in idp.findall("md:Extensions/shibmd:Scope", _NS)]
@@ -398,7 +432,7 @@ def _from_metadata(given: list[str], config: dict[str, Any], data_dir: Path, fou
398
432
  for school, listed, scopes in _metadata_schools(federation, root):
399
433
  exact, partial = _matches(given, listed, scopes, school.entity_id)
400
434
  if exact or partial:
401
- found.add(school, exact)
435
+ found.add(school, exact, named=_named(given, listed))
402
436
 
403
437
 
404
438
  def _with_login_hosts(school: School, config: dict[str, Any], data_dir: Path) -> School:
@@ -417,6 +451,24 @@ def _with_login_hosts(school: School, config: dict[str, Any], data_dir: Path) ->
417
451
  school.domain or listed.domain, listed.login_hosts, school.scopes)
418
452
 
419
453
 
454
+ def _named(given: Iterable[str], listed_names: Iterable[str]) -> bool:
455
+ """One of the names given is one the entry is listed under."""
456
+ keys = {_key(n) for n in listed_names} - {""}
457
+ return any(_key(t) in keys for t in given)
458
+
459
+
460
+ def _named_as_given(school: School, given: list[str]) -> School:
461
+ """A school found only by its domain, under a login entry many schools share
462
+ (a school system's ID, a national entry: 2026-11-13), is named as the user named it: that
463
+ name is what publishers' choosers list it under; the user's English name
464
+ second when given, else the entry's."""
465
+ own = [t for t in given if not _is_entity_id(t) and not re.fullmatch(r"[\w-]+(?:\.[\w-]+)+", t)]
466
+ if not own:
467
+ return school
468
+ english = next((t for t in own if t.isascii()), school.name_en)
469
+ return replace(school, name=own[0], name_en=english)
470
+
471
+
420
472
  def find(query: str, config: dict[str, Any], data_dir: Path, *, also: Iterable[str] = ()) -> Lookup:
421
473
  """The school named ``query`` (any language, its domain or entityID), with
422
474
  ``also`` its other names (the English one, given by the caller)."""
@@ -429,6 +481,8 @@ def find(query: str, config: dict[str, Any], data_dir: Path, *, also: Iterable[s
429
481
  if "SeamlessAccess" in lookup.unavailable:
430
482
  _from_metadata(given, config, data_dir, found, lookup)
431
483
  school, candidates = found.decide()
484
+ if school is not None and school.entity_id not in found.named:
485
+ school = _named_as_given(school, given)
432
486
  lookup.school = _with_login_hosts(school, config, data_dir) if school else None
433
487
  lookup.candidates = candidates[:10]
434
488
  return lookup
@@ -385,16 +385,22 @@ def view(state: dict[str, Any] | None, now: float) -> dict[str, Any]:
385
385
  pass
386
386
  # Held by the hourly limit the user set: the capsule and the card say so, and that
387
387
  # it is the user's setting, not the publisher's (2026-11-12).
388
+ line = status_text(state, running) if running else ""
388
389
  hold = _hourly_hold(state, now) if running and not attention else None
389
390
  if hold:
390
391
  name, limit, resume = hold
392
+ # The phase recorded with the hold says it again below the notice; a line of
393
+ # the other lane (open download) stays (2026-11-13).
394
+ if line == str(state["hourly_wait"].get("phase") or ""):
395
+ line = ""
391
396
  part, publisher = "已达每小时上限", f"{resume} 继续"
392
397
  # One line on the card in either language: a longer publisher name (or a site's
393
398
  # host) is left out; the status line above already says what holds.
394
399
  name = name if len(name) <= HOLD_NAME_MAX else ""
395
- notice = (f"{name} 已达设置的每小时 {limit} 篇,{resume} 继续" if name and limit
396
- else f"已达设置的每小时 {limit} 篇,{resume} 继续" if limit
397
- else f"已达设置的每小时上限,{resume} 继续")
400
+ # The hour is over then and the count starts again (2026-11-13).
401
+ notice = (f"{name} 已达设置的每小时 {limit} 篇,{resume} 重新计数" if name and limit
402
+ else f"已达设置的每小时 {limit} 篇,{resume} 重新计数" if limit
403
+ else f"已达设置的每小时上限,{resume} 重新计数")
398
404
 
399
405
  return {
400
406
  "mode": mode, "tone": tone, "headline": headline,
@@ -406,8 +412,8 @@ def view(state: dict[str, Any] | None, now: float) -> dict[str, Any]:
406
412
  "where": " · ".join(v for v in (journal, publisher) if v),
407
413
  "title": str(state.get("title") or ""), "current": current,
408
414
  "run_id": str(state.get("run_id") or ""),
409
- "step": step, "steps": list(STEPS), "line": status_text(state, running) if running else "",
410
- "elapsed": elapsed, "attention": prompt, "notice": notice,
415
+ "step": step, "steps": list(STEPS), "line": line,
416
+ "elapsed": elapsed, "attention": prompt, "notice": notice, "hold": bool(hold),
411
417
  "completion_detail": str(state.get("phase") or "")
412
418
  if not running and state.get("stage") == "supplements_checked" else "",
413
419
  "summary": summary_view(state.get("results")) if mode == "done" else None,
@@ -1,12 +1,15 @@
1
- """At most ``publisher_hourly_limit`` articles per publisher in any hour (default 100).
1
+ """At most ``publisher_hourly_limit`` articles per publisher in each hour (default 100).
2
2
 
3
3
  Libraries count more than about a hundred downloads an hour as abuse, and
4
4
  publishers suspend the school's access for it (dependencies section 6, state L).
5
- Every article about to open a publisher's site is counted in
6
- ``<data dir>/publisher_rate.json``. Once a publisher has had its hour's worth,
7
- the next article waits until the oldest of them is an hour old: the backend
8
- answers ``rate_limited`` with the seconds to wait, and psc's batch waits and
9
- tries the same article again.
5
+ A publisher's hour starts with the first article opened on its site, and
6
+ ``<data dir>/publisher_rate.json`` keeps when it started and how many it has
7
+ opened. Once the hour has its limit, the next article waits until the hour is
8
+ over; the count then starts again with that article. (Counted over any 60
9
+ minutes, a batch went on one article at a time as each of the last hour's aged
10
+ out, which read as stopping again and again: the user, 2026-11-13.) The backend
11
+ answers ``rate_limited`` with the seconds to wait, and psc's batch waits and tries
12
+ the same article again.
10
13
  """
11
14
  from __future__ import annotations
12
15
 
@@ -23,10 +26,20 @@ def ledger_path() -> Path:
23
26
  return _data_dir() / "publisher_rate.json"
24
27
 
25
28
 
26
- def _last_hour(data: dict, key: str, now: float) -> list[float]:
27
- times = data.get(key)
28
- return sorted(t for t in times if isinstance(t, (int, float)) and now - HOUR < t <= now) \
29
- if isinstance(times, list) else []
29
+ def _hour(data: dict, key: str, now: float) -> tuple[float, int] | None:
30
+ """(start, count) of ``key``'s hour still running at ``now``; None when none is."""
31
+ entry = data.get(key)
32
+ if isinstance(entry, list):
33
+ # Written before 0.6.3, the times of the articles opened: their hour starts with the oldest of the last hour.
34
+ times = sorted(t for t in entry if isinstance(t, (int, float)) and now - HOUR < t <= now)
35
+ entry = {"start": times[0], "count": len(times)} if times else None
36
+ if not isinstance(entry, dict):
37
+ return None
38
+ start, count = entry.get("start"), entry.get("count")
39
+ if (not isinstance(start, (int, float)) or isinstance(start, bool)
40
+ or not isinstance(count, int) or isinstance(count, bool) or not now - HOUR < start <= now):
41
+ return None
42
+ return float(start), count
30
43
 
31
44
 
32
45
  def wait_seconds(key: str, limit: int, now: float | None = None) -> int:
@@ -34,18 +47,19 @@ def wait_seconds(key: str, limit: int, now: float | None = None) -> int:
34
47
  if limit <= 0 or not key:
35
48
  return 0
36
49
  now = time.time() if now is None else now
37
- recent = _last_hour(_read_json(ledger_path()), key, now)
38
- if len(recent) < limit:
50
+ hour = _hour(_read_json(ledger_path()), key, now)
51
+ if hour is None or hour[1] < limit:
39
52
  return 0
40
- return int(recent[-limit] + HOUR - now) + 1
53
+ return int(hour[0] + HOUR - now) + 1
41
54
 
42
55
 
43
56
  def record(key: str, now: float | None = None) -> None:
44
- """Count one article opened on ``key``'s site; older entries are dropped."""
57
+ """Count one article opened on ``key``'s site, in its hour or in a new one; hours over are dropped."""
45
58
  if not key:
46
59
  return
47
60
  now = time.time() if now is None else now
48
61
  data = _read_json(ledger_path())
49
- kept = {name: times for name in data if (times := _last_hour(data, name, now))}
50
- kept.setdefault(key, []).append(now)
62
+ kept = {name: {"start": hour[0], "count": hour[1]} for name in data if (hour := _hour(data, name, now))}
63
+ current = kept.get(key, {"start": now, "count": 0})
64
+ kept[key] = {"start": current["start"], "count": current["count"] + 1}
51
65
  _write_json(ledger_path(), kept)
@@ -129,7 +129,8 @@ def school_download(
129
129
  f"{result.get('publisher')} 一小时内已打开 {result.get('limit')} 篇(每小时上限),{resume} 继续这一篇")
130
130
  # The window says so until then, beside the other lane's lines (2026-11-12).
131
131
  outcome["hourly_wait"] = {"publisher": str(result.get("publisher") or ""),
132
- "limit": result.get("limit"), "until": until}
132
+ "limit": result.get("limit"), "until": until,
133
+ "phase": outcome["paused"]}
133
134
  if result.get("error_type") == "paywall" or result.get("action") == "login_required":
134
135
  result["agent_hint"] = (
135
136
  "此论文需要机构登录。请让用户在弹出的下载浏览器窗口里完成登录或人工验证后重试;"
@@ -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.2"
7
+ version: "0.6.4"
8
8
  ---
9
9
 
10
10
  # 文献检索与下载(paper-search)
@@ -1,6 +1,6 @@
1
1
  # 学校订阅下载:各学术身份联盟支持情况
2
2
 
3
- 本表说明学校订阅下载能经哪些学术身份联盟登录(截至 2026-11-12)。“支持”是说:用户说出学校名称,程序能查出学校所属的联盟,并在出版社网站上自动选好联盟和学校,走到学校的登录页。登录之后能否下到全文,取决于学校的订阅,以及出版社是否给这所学校开通了学校账号登录。
3
+ 本表说明学校订阅下载能经哪些学术身份联盟登录(截至 2026-11-13)。“支持”是说:用户说出学校名称,程序能查出学校所属的联盟,并在出版社网站上自动选好联盟和学校,走到学校的登录页。登录之后能否下到全文,取决于学校的订阅,以及出版社是否给这所学校开通了学校账号登录。
4
4
 
5
5
  各国的学术身份联盟通过 eduGAIN 互联,出版社借此认可各国学校的账号;OpenAthens 是跨国的机构登录服务,没有加入本国联盟的学校不少经它登录。
6
6
 
@@ -11,37 +11,110 @@
11
11
 
12
12
  符号:✓ 已实测(自动走到学校登录页);○ 已支持,尚未实测。
13
13
 
14
+ 按大洲和区域列出,顺序与扩展计划相同:亚洲(东亚、东南亚、南亚、中亚、西亚)→ 欧洲(西欧、北欧、中欧、南欧、东欧)→ 美洲(北美洲:美国、加拿大;拉丁美洲和加勒比:中美洲、加勒比、南美洲)→ 大洋洲(澳大利亚与新西兰、美拉尼西亚、密克罗尼西亚、波利尼西亚)→ 非洲。
15
+
14
16
  ## 亚洲
15
17
 
18
+ ### 东亚
19
+
16
20
  | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
17
21
  | --- | --- | --- | --- | --- | --- |
18
22
  | 中国内地、澳门 | CARSI | CERNET 联邦认证与资源共享基础设施(CERNET Authentication and Resource Sharing Infrastructure) | 约 590 | ✓ | 澳门大学、澳门科技大学 |
19
23
  | 香港 | HKAF | Hong Kong Access Federation | 15 | ✓ | 香港大学、香港中文大学、香港科技大学、香港理工大学 |
20
- | 新加坡 | SGAF | Singapore Access Federation | 13 | ✓ | 新加坡国立大学、南洋理工大学、新加坡管理大学 |
21
24
  | 日本 | GakuNin(学認) | 学術認証フェデレーション(Academic Access Management Federation in Japan) | 约 170 | ✓ | 东京大学、大阪大学、东北大学、庆应义塾大学、早稻田大学 |
22
25
  | 韩国 | KAFE | Korean Access Federation | 27 | ✓ | KAIST、延世大学、浦项工科大学、成均馆大学 |
26
+ | 中国内地(科研机构) | CSTCloud | 中国科技云联盟(CSTCloud Federation) | 10 | ✓ | 中国科学院上海应用物理研究所(经中国科技云通行证)、北京协和医学院(经协和统一身份认证) |
27
+
28
+ - 中国科技云联盟供中国内地的科研院所等机构使用;同时在 CARSI 里的学校按 CARSI 登录。经共用入口登录的科研院所,配置时同时给出机构名称和官网域名。
29
+ - 台湾没有加入 eduGAIN 的联盟,台湾的学校经 OpenAthens 登录;没有接入 OpenAthens 的台湾学校暂时无法使用。
30
+
31
+ ### 东南亚
32
+
33
+ | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
34
+ | --- | --- | --- | --- | --- | --- |
35
+ | 新加坡 | SGAF | Singapore Access Federation | 13 | ✓ | 新加坡国立大学、南洋理工大学、新加坡管理大学 |
23
36
  | 马来西亚 | SIFULAN | SIFULAN Malaysian Access Federation | 约 150 | ✓ | 马来西亚理科大学、博特拉大学 |
37
+
38
+ - 泰国、菲律宾等地的学校多经 OpenAthens 登录(见“跨地区”);泰国的联盟 ThaiIDF 只有两个全国入口,且交给 eduGAIN 的名单目前已过期,暂不支持。
39
+
40
+ ### 南亚
41
+
42
+ | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
43
+ | --- | --- | --- | --- | --- | --- |
24
44
  | 印度 | INFED | INFLIBNET Access Management Federation | 约 390 | ✓ | 印度理工学院德里分校 |
25
- | 土耳其 | YETKİM | YETKİM Identity Federation | 约 170 | ✓ | 哈杰泰佩大学、中东技术大学、海峡大学、伊斯坦布尔大学 |
26
45
  | 斯里兰卡 | LIAF | LEARN Identity Access Federation | 31 | ✓ | 科伦坡大学 |
27
46
  | 孟加拉 | TIGERfed | Trust, Identity and Group management for Education and Research Federation | 30 | ✓ | 孟加拉工程技术大学 |
28
47
  | 巴基斯坦 | PKIFED | Pakistan Identity Federation | 8 | ✓ | COMSATS 大学伊斯兰堡分校、巴基斯坦国立科技大学、真纳大学 |
48
+
49
+ - 巴基斯坦有一百多所学校经 PERN 全国共用入口登录,联盟名单里只有它们的域名:按校名查不到时,同时给出校名和学校官网域名配置。
50
+
51
+ ### 中亚
52
+
53
+ 暂无可用的联盟:吉尔吉斯斯坦的 KRENA 只有联盟自己的一个账号入口,没有学校入口;塔吉克斯坦的联盟尚未正式运行;哈萨克斯坦、乌兹别克斯坦没有联盟。
54
+
55
+ ### 西亚
56
+
57
+ | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
58
+ | --- | --- | --- | --- | --- | --- |
59
+ | 土耳其 | YETKİM | YETKİM Identity Federation | 约 170 | ✓ | 哈杰泰佩大学、中东技术大学、海峡大学、伊斯坦布尔大学 |
60
+ | 沙特阿拉伯 | Maeen | Maeen Identity Federation | 36 | ○ | — |
61
+ | 塞浦路斯 | CyNet | CyNet Identity Federation | 10 | ✓ | 塞浦路斯大学、塞浦路斯技术大学 |
62
+ | 以色列 | IUCC | IUCC Identity Federation | 1 个共用入口 | ✓ | 特拉维夫大学、希伯来大学 |
63
+ | 伊朗 | IRFED | IRFED | 2 | ○ | — |
64
+ | 阿塞拜疆 | AzScienceNet | AzScienceNet Identity Federation | 2 | ○ | — |
29
65
  | 阿曼 | OMREN | OMREN Identity Federation | 约 30 | ○ | — |
30
- | 跨地区 | OpenAthens | OpenAthens 机构登录服务 | — | ✓ | 马来亚大学、朱拉隆功大学、菲律宾大学 Diliman、名古屋大学、台湾大学、阳明交通大学、台湾师范大学 |
31
66
 
32
- - 联盟内学校数取自 eduGAIN 登记的身份提供方数量,一所学校可能登记不止一个。
33
- - OpenAthens 不是某个国家的联盟,是跨国的机构登录服务;学校同时有本国联盟入口时,程序优先用联盟的。
34
- - 台湾没有加入 eduGAIN 的联盟,台湾的学校经 OpenAthens 登录;没有接入 OpenAthens 的台湾学校暂时无法使用。
35
- - 巴基斯坦有一百多所学校经 PERN 全国共用入口登录,联盟名单里只有它们的域名:按校名查不到时,用学校官网域名配置。
67
+ - 以色列的大学经 IUCC 共用入口登录,联盟名单里只有它们的域名:配置时同时给出校名和学校官网域名。
68
+ - 沙特的大学在出版社上能自动选中,但从境外测试时,有的学校登录服务器连不上,有的学校未为出版社开通,尚未走到能输入账号的登录页。
69
+ - 伊朗、阿塞拜疆的联盟各只有一所学校;出版社不一定为这些学校开通联盟登录,程序会写明原因。
36
70
  - 阿曼 OMREN 交给 eduGAIN 的学校名单目前已过期,阿曼的学校暂时查不到;名单恢复后无需改动即可使用。
37
- - 学校登录服务器连不上,或学校认证服务器拒绝出版社的登录请求时,程序立即结束并说明“学校登录系统出错”;这类情况要由学校处理。
71
+ - 亚美尼亚、格鲁吉亚的联盟只登记了网络运营方、研究所和图书馆的入口,没有学校入口;黎巴嫩的联盟尚未正式运行。
72
+
73
+ ## 欧洲
74
+
75
+ ### 西欧
76
+
77
+ | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
78
+ | --- | --- | --- | --- | --- | --- |
79
+ | 英国 | UK federation | UK Access Management Federation | 约 690 | ✓ | 牛津大学、剑桥大学、帝国理工学院、伦敦大学学院、伦敦国王学院、爱丁堡大学、伦敦政治经济学院 |
80
+ | 爱尔兰 | Edugate | Edugate | 41 | ✓ | 都柏林圣三一学院、都柏林大学 |
81
+ | 法国 | RENATER | Fédération Éducation-Recherche | 约 310 | ✓ | 巴黎西岱大学、巴黎-萨克雷大学、斯特拉斯堡大学 |
82
+ | 荷兰 | SURFconext | SURFconext | 约 200 | ✓ | 阿姆斯特丹大学、莱顿大学、乌得勒支大学、代尔夫特理工大学 |
83
+ | 比利时 | Belnet | Belnet Federation | 58 | ✓ | 根特大学、鲁汶天主教大学、布鲁塞尔自由大学 |
84
+ | 卢森堡 | eduID Luxembourg | eduID Luxembourg | 12 | ✓ | 卢森堡大学 |
85
+
86
+ - 荷兰的学校都经 SURFconext 的统一中转站登录,程序自动经过。
87
+ - 法国、荷兰、比利时的学校可以用当地语言的校名配置;出版社按一个名称搜不到时,程序会换学校的其他名称再搜。
88
+
89
+ 计划中:北欧、中欧、南欧、东欧。
38
90
 
39
91
  ## 美洲
40
92
 
93
+ ### 北美洲
94
+
41
95
  | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
42
96
  | --- | --- | --- | --- | --- | --- |
43
97
  | 美国 | InCommon | InCommon Federation | 约 590 | ✓ | 斯坦福大学、麻省理工学院、耶鲁大学、普林斯顿大学、哥伦比亚大学、加州大学伯克利分校、加州大学洛杉矶分校、加州大学旧金山分校、密歇根大学、宾夕法尼亚大学、杜克大学、华盛顿大学、纽约大学、康奈尔大学、约翰斯·霍普金斯大学 |
44
98
 
45
- ## 计划中
99
+ 计划中:加拿大,再拉丁美洲和加勒比(中美洲、加勒比、南美洲)。
100
+
101
+ ## 大洋洲
102
+
103
+ 计划中:澳大利亚与新西兰、美拉尼西亚、密克罗尼西亚、波利尼西亚。
46
104
 
47
- 英国(UK federation)、澳大利亚(AAF)、欧洲各国联盟,之后是 eduGAIN 里的其他国家。
105
+ ## 非洲
106
+
107
+ 计划中。
108
+
109
+ ## 跨地区
110
+
111
+ | 地区 | 联盟 | 全称 | 联盟内学校数 | 状态 | 已实测的学校 |
112
+ | --- | --- | --- | --- | --- | --- |
113
+ | 跨地区 | OpenAthens | OpenAthens 机构登录服务 | — | ✓ | 马来亚大学、朱拉隆功大学、菲律宾大学 Diliman、名古屋大学、台湾大学、阳明交通大学、台湾师范大学 |
114
+
115
+ - OpenAthens 不是某个国家的联盟,是跨国的机构登录服务;学校同时有本国联盟入口时,程序优先用联盟的。
116
+
117
+ ## 说明
118
+
119
+ - 联盟内学校数取自 eduGAIN 登记的身份提供方数量,一所学校可能登记不止一个。
120
+ - 学校登录服务器连不上,或学校认证服务器拒绝出版社的登录请求时,程序立即结束并说明“学校登录系统出错”;这类情况要由学校处理。
@@ -53,8 +53,9 @@ paper-search school login --doi <学校订阅的一篇文章的 DOI>
53
53
  paper-search-school setup --institution "用户说的校名" [--also-name "学校的英文正式名称"]
54
54
  ```
55
55
 
56
- - 目前支持中国内地和澳门(CARSI)、香港(HKAF)、新加坡(SGAF)、日本(GakuNin)、韩国(KAFE)、马来西亚(SIFULAN)、印度(INFED)、土耳其(YETKİM)、斯里兰卡(LIAF)、孟加拉(TIGERfed)、巴基斯坦(PKIFED)、阿曼(OMREN)、美国(InCommon)的学术身份联盟,以及只经 OpenAthens 登录的学校。`--institution` 可以是校名(任何语言)、学校域名或 entityID;后端在各联盟的学校名单里查,确定是哪一所才保存,并保存它所属的联盟。
57
- - 联盟名单里的校名是当地语言和英文(中国内地、澳门有中文,日本有日文,土耳其有土耳其文,香港、韩国、新加坡、马来西亚、南亚和美国多只有英文)。用户说的校名不是这两种时,加 `--also-name` 给出学校的英文正式名称;不确定英文名就不加。
56
+ - 目前支持中国内地和澳门(CARSI)、香港(HKAF)、新加坡(SGAF)、日本(GakuNin)、韩国(KAFE)、马来西亚(SIFULAN)、印度(INFED)、土耳其(YETKİM)、斯里兰卡(LIAF)、孟加拉(TIGERfed)、巴基斯坦(PKIFED)、阿曼(OMREN)、中国内地科研机构(CSTCloud)、沙特阿拉伯(Maeen)、塞浦路斯(CyNet)、以色列(IUCC)、伊朗(IRFED)、阿塞拜疆(AzScienceNet)、英国(UK federation)、爱尔兰(Edugate)、法国(RENATER)、荷兰(SURFconext)、比利时(Belnet)、卢森堡(eduID Luxembourg)、美国(InCommon)的学术身份联盟,以及只经 OpenAthens 登录的学校。`--institution` 可以是校名(任何语言)、学校域名或 entityID;后端在各联盟的学校名单里查,确定是哪一所才保存,并保存它所属的联盟。
57
+ - 联盟名单里的校名是当地语言和英文(中国内地、澳门有中文,日本有日文,土耳其有土耳其文,法国、荷兰、比利时等欧洲国家多有当地语言名,香港、韩国、新加坡、马来西亚、南亚和美国多只有英文)。用户说的校名不是这两种时,加 `--also-name` 给出学校的英文正式名称;不确定英文名就不加。
58
+ - 有些学校经多校共用的登录入口登录(如以色列的大学、中国内地的科研院所、巴基斯坦的部分学校),联盟名单里只有它们的域名:按校名查不到时,用 `--institution <校名> --also-name <学校官网域名>` 再查一次,程序会按域名找到入口,并按所给校名在出版社搜索。
58
59
  - 返回 `school_ambiguous` 时,把 `candidates`(含学校名、联盟、域名)列给用户选,再用所选学校的 `entity_id` 作为 `--institution` 重新运行;只有一个候选也要问,那是名字不完全一致的学校。`school_not_found` 时请用户换成学校正式名称、英文名或学校域名,仍找不到就按回复里的 `reasons` 如实说明:这所学校可能没有接入学术身份联盟或 OpenAthens,学校订阅下载无法为它登录;`federation_not_supported` 是找到了学校但它所属的联盟还不支持,如实告诉用户;`school_list_unavailable` 是名单取不到,稍后重试。
59
60
  - `--carsi --institution` 只在 CARSI 名单里查(错误码 `carsi_school_*`);查 CARSI 名单:`paper-search-school setup --list-carsi-schools 关键词`。
60
61
  - `setup --check` 的 `school` 项为 `missing` 时,说明只存了学校名,按提示重新运行上面的命令。