Skip to content

Instantly share code, notes, and snippets.

@imhemish
Created June 24, 2024 16:24
Show Gist options
  • Save imhemish/33d094b5896b3ce2d6370d4dccad15bf to your computer and use it in GitHub Desktop.
Save imhemish/33d094b5896b3ce2d6370d4dccad15bf to your computer and use it in GitHub Desktop.
aglasem-download
from requests import get
from img2pdf import convert
prefix = input("Enter prefix url: ")
rng = input("Enter range: ")
name = input("Enter name: ")
start, end = tuple(rng.split("-"))
start, end = int(start), int(end)
for i in range(start, end+1):
with open(f"{i}.jpg", "wb") as file:
file.write(get(f"{prefix}{i}.jpg").content)
pdffile = open(name+".pdf", "wb")
pdffile.write(convert([str(i)+".jpg" for i in range(start, end+1)]))
pdffile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment