Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Saves ArXiv papers locally in the directory in which the script is run in. Intended to run on GNU/Linux but should work on any system
- import shutil, requests, time
- from random import randint
- while True:
- try:
- r0 = randint(10, 20)
- r1 = randint(1, 9)
- r2 = randint(1000, 9999)
- url = "https://arxiv.org/pdf/" + str(r0) + "0" + str(r1) + ".0" + str(r2) + ".pdf"
- response = requests.get(url, stream=True)
- with open(str(r0) + '0' + str(r1) + '.0' + str(r2) + '.pdf', 'wb') as out_file:
- shutil.copyfileobj(response.raw, out_file)
- del response
- except:
- time.sleep(5) # Prevent ratelimiting
Add Comment
Please, Sign In to add comment