import urllib2, os, threading, time, sys URL = "http://img.4chan.org/b/imgboard.html" #"http://img.4chan.org/b/res/53264202.html" imgdir = "_4chan" I = 0 Y = 0 T = 0 recurse = False def log(msg): print "[%s]: %s" % (time.strftime("%I:%M"),msg) if "-r" in sys.argv or "-recurse" in sys.argv or "-watch" in sys.argv: log( "recursing enabled" ) recurse = True else: log( "recursing disabled" ) def threadurl(thread): nurl = "http://img.4chan.org/b/res/%s" % thread #log( "threadurl: %s" % nurl ) return nurl class FetchThread(threading.Thread): def __init__(self, topic): self.topic = topic threading.Thread.__init__(self) def run(self): global I log( "fetching topic %s" % self.topic ) s=urllib2.urlopen(self.topic);html=s.read();s.close() g = html.split("File :