From f7d14634f889c92cea97ca555557871506bc7600 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sat, 31 Jan 2026 09:51:52 +0800 Subject: [PATCH 1/2] =?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) From d813a5365272517cb96258d5851a1018e5631418 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sat, 31 Jan 2026 09:53:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20paper=20list=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/resm/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/resm/views.py b/apps/resm/views.py index 5abfecc..fde4e9e 100644 --- a/apps/resm/views.py +++ b/apps/resm/views.py @@ -9,7 +9,8 @@ from rest_framework.permissions import AllowAny class PaperViewSet(CustomGenericViewSet, CustomListModelMixin): queryset = Paper.objects.all() serializer_class = PaperListSerializer - filterset_fields = ["publication_year", "type", "fetch_status"] + filterset_fields = ["publication_year", "type", "fetch_status", + "has_abstract", "has_fulltext"] search_fields = ['title', 'first_author', 'first_author_institution'] ordering = ["-publication_date", "-create_time"]