Skip to content

Instantly share code, notes, and snippets.

@codefalasi
Created November 10, 2014 07:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save codefalasi/ac2d0a4f53e5de79a999 to your computer and use it in GitHub Desktop.
Save codefalasi/ac2d0a4f53e5de79a999 to your computer and use it in GitHub Desktop.
axel batch bulk download python script
#!/usr/bin/env python
import os
import base64
import time
# Axel is an awesome lightweight linux command line download accelerator,
# this script reads links from a given text file and executes axel
# automating batch/bulk downloads at high speeds
#
# I plan to add more options to this script when i find time
# enjoy and feel free to fix or use this code
# Coded by CodeFalasi
# Twitter @CodeFalasi
print '[i] Axel batch downloader v 1.0'
time.sleep(0.9)
userinputfile = raw_input("[?] Text file holding links: ")
print '[!] Answer y for yes or n for no, Case sensative!'
usrchk = raw_input("[?] Does this site require authentication? [y/n] ")
if usrchk == 'y':
username = raw_input('[?] Username: ')
password = raw_input('[?] Password: ')
base64AuthCode = base64.b64encode(username + ':' + password)
print '[i] Running axel with http auth: '
time.sleep(1.9)
f = open(userinputfile, "r")
for line in f.read().split('\n'):
cmd = "axel -a -n 20 -H 'Authorization: Basic %s " %base64AuthCode + "' " + line
os.system(cmd)
f.close()
print '[i] Done...'
else:
print '[i] Running axel '
time.sleep(1.9)
f = open(userinputfile, "r")
for line in f.read().split('\n'):
os.system('axel -a -n 20 ' + line )
print '[i] Done...'
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment