feat: 需要保存openalex pdferror

This commit is contained in:
caoqianming 2026-02-10 14:13:50 +08:00
parent 3c568c076b
commit b300c1779b
1 changed files with 4 additions and 1 deletions

View File

@ -153,7 +153,7 @@ def get_pdf_from_openalex(number_of_task: int =10):
return "stoped" return "stoped"
count = 0 count = 0
qs = Paper.objects.filter(is_oa=True, has_fulltext=False).exclude( qs = Paper.objects.filter(is_oa=True, has_fulltext=False).exclude(
fetch_status="downloading")[:number_of_task] fetch_status="downloading").exclude(fail_reason__contains="openalex_pdf_not_found")[:number_of_task]
if not qs.exists(): if not qs.exists():
return "done" return "done"
for paper in qs: for paper in qs:
@ -462,6 +462,9 @@ def save_pdf_from_openalex(paper:Paper):
elif res.status_code == 404: elif res.status_code == 404:
paper.save_fail_reason("openalex_pdf_not_found") paper.save_fail_reason("openalex_pdf_not_found")
return "openalex_pdf_error: 404" return "openalex_pdf_error: 404"
else:
paper.save_fail_reason("openalex_pdf_error")
return f"openalex_pdf_error: {res.status_code} {res.text}"
def save_pdf_from_elsevier(paper:Paper): def save_pdf_from_elsevier(paper:Paper):