feat: has_fulltext_pdf isf False时才去save
This commit is contained in:
parent
e2687874eb
commit
f7d14634f8
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue