Dianel555/DSkills / skills/literature-searcher
literature-searcher
VerifiedSearch CrossRef, OpenAlex, PubMed, Semantic Scholar, and optional Scopus; deduplicate results, download open-access PDFs by DOI, classify papers, monitor new results, and analyze coverage. Use when asked to search literature, monitor a topic, download an open-access paper, classify papers, or analyze literature gaps.
| File | Kind | Size |
|---|---|---|
| .env.example | other | 743 B |
| README.md | markdown | 3.7 KB |
| SKILL.md | skill md | 2.9 KB |
| literature_searcher/__init__.py | script | 3.1 KB |
| literature_searcher/classifier.py | script | 11.2 KB |
| literature_searcher/crossref_searcher.py | script | 2.8 KB |
| literature_searcher/downloader.py | script | 5.3 KB |
| literature_searcher/insight.py | script | 6.0 KB |
| literature_searcher/monitor.py | script | 14.3 KB |
| literature_searcher/openalex_searcher.py | script | 3.0 KB |
| literature_searcher/pubmed_searcher.py | script | 6.1 KB |
| literature_searcher/scopus_searcher.py | script | 2.1 KB |
| literature_searcher/searcher.py | script | 3.4 KB |
| literature_searcher/semantic_scholar_searcher.py | script | 3.7 KB |
| monitor_config.json.template | other | 443 B |
| tests/test_literature_searcher.py | script | 9.7 KB |
| tests/test_retry_budget.py | script | 898 B |
literature_searcher/crossref_searcher.py
View on GitHub"""
CrossRef API 搜索
"""
import json
import re
import urllib.parse
import urllib.request
from typing import List, Optional
from . import (
CROSSREF_API, USER_AGENT, LITERATURE_EMAIL, Paper,
generate_random_email, safe_int,
)
class CrossRefSearcher:
"""CrossRef API 搜索"""
@staticmethod
def search(query: str, limit: int = 20, year_from: Optional[int] = None,
year_to: Optional[int] = None) -> List[Paper]:
papers = []
try:
params = {
"query": query,
"rows": min(limit, 100),
"mailto": LITERATURE_EMAIL or generate_random_email(),
}
filters = []
if year_from:
filters.append(f"from-pub-date:{year_from}")
if year_to:
filters.append(f"until-pub-date:{year_to}")
if filters:
params["filter"] = ",".join(filters)
url = f"{CROSSREF_API}/works?{urllib.parse.urlencode(params)}"
req = urllib.request.Request(url)
req.add_header("User-Agent", USER_AGENT)
with urllib.request.urlopen(req, timeout=30) as resp:
data = json.loads(resp.read().decode("utf-8"))
for item in data.get("message", {}).get("items", []):
authors = []
for auth in item.get("author", []):
name_parts = [auth.get("given", ""), auth.get("family", "")]
authors.append(" ".join(p for p in name_parts if p))
pub_date = item.get("published-print", item.get("published-online", {}))
year = None
if "date-parts" in pub_date and pub_date["date-parts"]:
year = safe_int(str(pub_date["date-parts"][0][0]))
title_parts = item.get("title", [""])
title = title_parts[0] if title_parts else ""
abstract = item.get("abstract", "")
if abstract:
abstract = _clean_jats(abstract).strip()
doi = item.get("DOI", "")
papers.append(Paper(
title=title,
abstract=abstract,
authors=authors,
doi=doi,
year=year,
citations=safe_int(str(item.get("is-referenced-by-count", 0))),
journal=item.get("container-title", [""])[0] if item.get("container-title") else "",
source_platform="crossref",
issn=item.get("ISSN", [""])[0] if item.get("ISSN") else None,
))
except Exception as e:
print(f"[CrossRef] 搜索错误: {e}")
return papers[:limit]
def _clean_jats(text: str) -> str:
return re.sub(r"<[^>]+>", "", text)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |