Skip to content
sailfish009 edited this page Aug 2, 2023 · 2 revisions

Welcome to the paper wiki!

"""
[email protected]
download.py : Download PDF Files
pip install arxiv
cd /work
git clone https://github.com/sailfish009/paper
python download.py
"""
import os
import sys
import datetime
import arxiv

sys.stdin.reconfigure(encoding='utf-8')
sys.stdout.reconfigure(encoding='utf-8')
sys.stderr.reconfigure(encoding='utf-8')

d1 = datetime.datetime(2020, 2, 19) 
d2 = datetime.datetime(2020, 2, 20) # 2023, 8. 1

d = d2-d1
list_days = [ (d1 + datetime.timedelta(days=i)).strftime('%Y.%m.%d') for i in range(d.days + 1)]

dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)

for day in list_days:
    day += ".txt"
    current_path = os.path.join(dir_path, "paper", day)
    if os.path.exists(current_path):
        with open(current_path, encoding='utf-8') as file:
            lines = [(line.split('TITLE:'))[1].strip() for line in file if line[0].isdigit() == True]

        for line in lines:
            print(line)
            search = arxiv.Search(query=line)
            paper = next(search.results())
            paper.download_pdf()

Clone this wiki locally