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

Function collect_all_papers

scripts/collect_all_papers.py:178–221  ·  view source on GitHub ↗

从所有来源收集论文 Args: start_date: 开始日期 (YYYYMMDD) end_date: 结束日期 (YYYYMMDD) sources: 来源列表 limit_per_source: 每个来源的抓取数量限制 Returns: 新增论文数量

(
    start_date: str,
    end_date: str,
    sources: List[str] = None,
    limit_per_source: int = 200,
)

Source from the content-addressed store, hash-verified

176
177
178def collect_all_papers(
179 start_date: str,
180 end_date: str,
181 sources: List[str] = None,
182 limit_per_source: int = 200,
183) -> int:
184 """
185 从所有来源收集论文
186
187 Args:
188 start_date: 开始日期 (YYYYMMDD)
189 end_date: 结束日期 (YYYYMMDD)
190 sources: 来源列表
191 limit_per_source: 每个来源的抓取数量限制
192
193 Returns:
194 新增论文数量
195 """
196 conn = init_db()
197
198 before_count = conn.execute("SELECT COUNT(*) FROM papers").fetchone()[0]
199 print(f"Before: {before_count} papers in database")
200
201 if sources is None:
202 sources = ["arxiv", "openreview", "journal"]
203
204 total_new = 0
205 for source in sources:
206 new_count = collect_from_source(
207 conn=conn,
208 source=source,
209 start_date=start_date,
210 end_date=end_date,
211 limit=limit_per_source,
212 )
213 total_new += new_count
214 print(f" [{source}] Added {new_count} new papers")
215
216 after_count = conn.execute("SELECT COUNT(*) FROM papers").fetchone()[0]
217 print(f"\nAfter: {after_count} papers in database")
218 print(f"Total new papers added: {total_new}")
219
220 conn.close()
221 return total_new
222
223
224def main():

Callers 3

collect_papers_for_dayFunction · 0.90
precollect_by_dayFunction · 0.90
mainFunction · 0.85

Calls 4

collect_from_sourceFunction · 0.85
init_dbFunction · 0.70
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected