aboutsummaryrefslogtreecommitdiff
path: root/bot4chan.py
diff options
context:
space:
mode:
authorache <ache@ache.one>2016-12-12 03:03:05 +0100
committerache <ache@ache.one>2016-12-12 03:03:32 +0100
commit0cb5015baefd6afe54317b8acf06e890116ec936 (patch)
tree90628b3e035e9e8fdc33ce09efd0e6ab8a8bb508 /bot4chan.py
parentFix bot4chan firt argument download (diff)
Add bot4chan second argument (the directory)
Diffstat (limited to 'bot4chan.py')
-rwxr-xr-xbot4chan.py10
1 files changed, 8 insertions, 2 deletions
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 = '<span class="filesize">(File : |File)<a href="(.*?)" target="_blank">(.*?)</a>'
regex = '<a class="fileThumb" href="(.*?)" target="_blank">'
-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)