保存单篇论文到数据库
(conn: sqlite3.Connection, paper: Dict)
| 55 | |
| 56 | |
| 57 | def save_paper(conn: sqlite3.Connection, paper: Dict) -> None: |
| 58 | """保存单篇论文到数据库""" |
| 59 | conn.execute(""" |
| 60 | INSERT OR REPLACE INTO papers |
| 61 | (arxiv_id, title, abstract, authors, categories, publish_date, pdf_url, doi, created_at) |
| 62 | VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) |
| 63 | """, ( |
| 64 | paper.get("arxiv_id", ""), |
| 65 | paper.get("title", ""), |
| 66 | paper.get("abstract", ""), |
| 67 | ",".join(paper.get("authors", [])), |
| 68 | ",".join(paper.get("categories", [])), |
| 69 | paper.get("publish_date", ""), |
| 70 | paper.get("pdf_url", ""), |
| 71 | paper.get("doi", ""), |
| 72 | datetime.now().isoformat(), |
| 73 | )) |
| 74 | conn.commit() |
| 75 | |
| 76 | |
| 77 | def collect_papers( |
no test coverage detected