From f7d14634f889c92cea97ca555557871506bc7600 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sat, 31 Jan 2026 09:51:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20has=5Ffulltext=5Fpdf=20isf=20False?= =?UTF-8?q?=E6=97=B6=E6=89=8D=E5=8E=BBsave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/resm/tasks.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/resm/tasks.py b/apps/resm/tasks.py index da1ac8e..ef5a88e 100644 --- a/apps/resm/tasks.py +++ b/apps/resm/tasks.py @@ -21,6 +21,12 @@ config.retry_http_codes = [429, 500, 503] OPENALEX_KEY = "NPimoE2ecdWmfdhH8abxEp" config.api_key = OPENALEX_KEY +ELSEVIER_APIKEY = 'aa8868cac9e27d6153ab0a0acd7b50bf' +ELSEVIER_HEAEDERS = { + "X-ELS-APIKey": ELSEVIER_APIKEY, + "X-ELS-Insttoken": "135fa874aea9f0de11cad187ccb4878c " +} + @shared_task(base=CustomTask) def get_paper_meta_from_openalex(publication_year:int, keywords:str="", search:str="", end_year:int=None): cache_key = f"openalex_cursor_{publication_year}_{keywords}{search}" @@ -94,9 +100,6 @@ def get_paper_meta_from_openalex(publication_year:int, keywords:str="", search:s countdown=5 ) - -ELSEVIER_APIKEY = 'aa8868cac9e27d6153ab0a0acd7b50bf' - # 常用的 User-Agent 列表 USER_AGENTS = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", @@ -191,7 +194,8 @@ def get_abstract_from_elsevier(number_of_task:int = 20): if has_fulltext: paper.has_fulltext = True paper.has_fulltext_xml = True - save_pdf_from_elsevier(paper) + if paper.has_fulltext_pdf is False: + save_pdf_from_elsevier(paper) count_fulltext += 1 paper.save_file_xml(xml_str)