def __init__(self,host,port,username,password): self.progress=kl_progressbar('downloading',30) self.maxthread=5 self.curthreadnum=0 self.threadlock=_thread.allocate_lock() ftplib.FTP.__init__(self) self.host=host self.port=port self.username=username self.password=password self.downloading=0 self.bigfile=[] self.ignorefolder=[] self.faillist=[] self.localroot='./' #初始化日志 self.log=kl_log('kl_ftp') self.__ftpconn()
def __init__(self, arg): super(urlspider, self).__init__() self.isproxy = False self.arg = arg self.hostname = arg['hostname'] self.linkreg = '<a[^><\n]*?href=["|\']{0,1}([^><\n]*?(?:00_00)[^><\n]*?)["|\']{0,1}[^><\n]*?>.*?</a>' self.url = arg['url'] self.charset = arg['charset'] self.mb_url_reg = arg['mb_url_reg'] self.mb_con_reg = arg['mb_con_reg'] self.link_tezheng = arg['link_tezheng'] self.shendu = int(arg['shendu']) self.url_table = arg['name'] + '_url' self.content_table = arg['name'] + '_content' self.urled_table = arg['name'] + '_urled' self.content_sql = arg['content_sql'] self.con_field = arg['field'] self.maxthread = 4 self.threadnum = 0 self.progress = kl_progressbar.kl_progressbar('正在运行中') self.mylock = _thread.allocate_lock() #线程锁 self.init()
def __init__(self, arg): super(urlspider, self).__init__() self.isproxy=False self.arg = arg self.hostname=arg['hostname'] self.linkreg='<a[^><\n]*?href=["|\']{0,1}([^><\n]*?(?:00_00)[^><\n]*?)["|\']{0,1}[^><\n]*?>.*?</a>' self.url=arg['url'] self.charset=arg['charset'] self.mb_url_reg=arg['mb_url_reg'] self.mb_con_reg=arg['mb_con_reg'] self.link_tezheng=arg['link_tezheng'] self.shendu=int(arg['shendu']) self.url_table=arg['name']+'_url' self.content_table=arg['name']+'_content' self.urled_table=arg['name']+'_urled' self.content_sql=arg['content_sql'] self.con_field=arg['field'] self.maxthread=4 self.threadnum=0 self.progress=kl_progressbar.kl_progressbar('正在运行中') self.mylock = _thread.allocate_lock()#线程锁 self.init()