ArXiV Mass Downloader

No.11030363 ViewReplyOriginalReport
I made this out of personal interest a while ago, am putting it here because many of you might find use for it. It's rushed and overall not that good of a script overall (it'll miss many articles depending on their ID and one will occasionally be corrupted/incomplete) but it will rapidly download ArXiV papers, just in case you want to hoard them or something. I tried making one for Vixra too but after learning about Tooker I'm quite thankful it didn't work. Source code below. It's in python3.
import shutil
import requests
from random import randint
import time

def save():
r0 = randint(10, 18)
r1 = randint(1, 12)
r2 = randint(1000, 9999)

if(len(str(r1)) == 1):
r1 = "0" + str(r1)

url = "https://arxiv.org/pdf/"; + str(r0) + str(r1) + ".0" + str(r2) + ".pdf"
response = requests.get(url, stream=True)
with open(str(r0) + str(r1) + '.0' + str(r2) + '.pdf', 'wb') as out_file:
shutil.copyfileobj(response.raw, out_file)
del response

while True:
try:
save()
except:
time.sleep(5)