aboutsummaryrefslogtreecommitdiff
path: root/bot4chan.py
blob: 736ad6e9f2a395544092deebe2dc6bbfa3b8ee0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# -*-coding:utf-8 -*

import re, os, sys

sujet = []
sujetT = []

os.system("wget " + sys.argv[1] + "  -O index.html -N -q")
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")
with open("index.html",'r') as f:
 for line in f:
  yes = re.search(regex, line)
  if yes :
   print(yes.group(1))
   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")