From 0cb5015baefd6afe54317b8acf06e890116ec936 Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 12 Dec 2016 03:03:05 +0100 Subject: Add bot4chan second argument (the directory) --- bot4chan.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bot4chan.py') diff --git a/bot4chan.py b/bot4chan.py index 736ad6e..ecdab75 100755 --- a/bot4chan.py +++ b/bot4chan.py @@ -11,7 +11,13 @@ os.system("sed -i 's/<\\/a>/<\\/a>\\n/g' index.html") regex = '(File : |File)(.*?)' regex = '' -os.system("mkdir -p dump") + +dumpDir = "dump" + +if len(sys.argv) >= 3 : + dumpDir = sys.argv[2] + +os.system("mkdir -p " + dumpDir) with open("index.html",'r') as f: for line in f: yes = re.search(regex, line) @@ -20,6 +26,6 @@ with open("index.html",'r') as f: sujetT.append( [yes.group(1)] ) print( "Téléchargement de : " + yes.group(1) ) os.system("wget " + 'http:' + yes.group(1) + " -N -q") - os.system("mv " + yes.group(1)[yes.group(1).rfind('/')+1:] + " dump") + os.system("mv " + yes.group(1)[yes.group(1).rfind('/')+1:] + " " + dumpDir) -- cgit v1.2.3