Last active
August 29, 2015 14:03
-
-
Save weirongxu/66acc5d74537ae1d575a to your computer and use it in GitHub Desktop.
aria2c by uri file.
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
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
import re, os | |
name = 'Video Name' | |
num = 1 | |
for line in file('uri', 'r'): | |
p = re.compile(r'\..{1,5}\?') | |
ex = p.search(line) | |
os.system("aria2c -x5 -o %s%02d.%s '%s'" | |
% ( name, | |
num, | |
ex.group()[1:-1], | |
line) | |
) | |
num += 1 |
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
#!/usr/bin/env bash | |
ext() | |
{ | |
ext=$(echo $@ | grep -oE '\..{1,5}\?') | |
len=${#ext} | |
echo ${ext:1:$len-2} | |
} | |
name_base='Video Name' | |
start_num=1 | |
while read line | |
do | |
# echo aria2c -x5 -o `printf "$name_base%02d.$(ext $line)" $start_num` "$line" | |
aria2c -x5 -o `printf "$name_base%02d.$(ext $line)" $start_num` "$line" | |
((start_num++)) | |
done < uri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment