MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / fetch_by_date

Function fetch_by_date

skills/journal-fetcher/scripts/fetch_journal.py:1276–1331  ·  view source on GitHub ↗

按日期范围获取论文(兼容 arxiv-fetcher 接口) Args: start_date: 开始日期 (YYYYMMDD) end_date: 结束日期 (YYYYMMDD) journals: 期刊列表 limit: 总数量限制 Returns: 论文列表

(
    start_date: str,
    end_date: str,
    journals: List[str] = None,
    limit: int = 50
)

Source from the content-addressed store, hash-verified

1274 details = [_fetch_article_detail(candidate["url"]) for candidate in candidates]
1275
1276 for candidate, detail in zip(candidates, details):
1277 if detail.get("_skip"):
1278 continue
1279 papers.append(_merge_detail_into_paper(candidate, detail))
1280 if len(papers) >= limit:
1281 break
1282
1283 except Exception as e:
1284 print(f"Error fetching {journal_info['name']}: {e}")
1285
1286 print(f" Fetched {len(papers)} papers from {journal_info['name']}")
1287 return papers
1288
1289
1290def extract_authors_from_rss(entry) -> List[str]:
1291 """从 RSS 条目中提取作者"""
1292 authors = []
1293
1294 # 尝试不同格式
1295 if hasattr(entry, 'author'):
1296 author_str = entry.author
1297 if author_str:
1298 # 分割多个作者
1299 for author in author_str.split(','):
1300 author = author.strip()
1301 if author:
1302 authors.append(author)
1303
1304 if hasattr(entry, 'authors'):
1305 for author in entry.authors:
1306 if isinstance(author, dict) and 'name' in author:
1307 authors.append(author['name'])
1308 elif isinstance(author, str):
1309 authors.append(author)
1310
1311 return authors[:10] # 限制作者数量
1312
1313
1314def extract_doi(entry) -> Optional[str]:
1315 """从 RSS 条目中提取 DOI"""
1316 # 尝试从链接中提取
1317 link = entry.get('link', '')
1318 if 'doi.org' in link:
1319 parts = link.split('doi.org/')
1320 if len(parts) > 1:
1321 return parts[1]
1322
1323 # 尝试从 DOI 字段提取
1324 if hasattr(entry, 'doi'):
1325 return entry.doi
1326
1327 return None
1328
1329
1330def fetch_by_date(
1331 start_date: str,
1332 end_date: str,
1333 journals: List[str] = None,

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
fetch_journal_papersFunction · 0.70

Tested by

no test coverage detected