Created
May 8, 2023 08:00
-
-
Save theorium-0/435b594950f5173d337e98bd5a7553c9 to your computer and use it in GitHub Desktop.
A mass file downloader written in only five lines. It could be shrunk and improved but I made this at 3:01AM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, urllib.request | |
from urllib.parse import urlsplit | |
LINK_FILE, links, filter, download = 'links.txt', [], (lambda l=None: links.append(l.replace('\n', '')) if l != "" or l != "\n" else None), (lambda url=None: urllib.request.urlretrieve(url, os.path.basename(urlsplit(url).path)) if url != None else None) | |
for line in open(os.path.join(os.getcwd(), LINK_FILE), 'w+').readlines(): filter(line) | |
for l in links: download(l) |
Usage
Paste the code from 5_line_mass_downloader.py into a python file then create a links.txt
file and paste any downloadable link on separate lines
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO (on a rainy day): implement duplicate file handling, error redirection, and possibly a simple UXUI.