def highlink_download(self): mkpath = str(time.strftime('%Y-%m-%d', time.localtime(time.time()))) if self.least_pages > 40: threads = [] for i in range(self.least_pages // 40): t = threading.Thread(target=self.highlikegetid, args=(i * 40, (i + 1) * 40)) threads.append(t) for t in threads: t.start() for t in tqdm.tqdm(threads): t.join(180) else: self.highlikegetid() saveimg.mkdir('highlikeimg') saveimg.mkdir('highlikeimg' + path_break + self.keyword + str(self.least_likes) + 'like' + mkpath + r18word(self.r18)) mkpath = 'highlikeimg' + path_break + self.keyword + str( self.least_likes) + 'like' + mkpath + r18word(self.r18) if self.threads: self.new_threadsave(mkpath) elif self.async_able: saveimg.async_save(self.dataids, self.cookies, mkpath) else: saveimg.save(number=self.number, dataids=self.dataids, cookies=self.cookies, path=mkpath) print('HighLike Done')
def db_download(self): con = sqlite3.connect('pixiv.db') cur = con.cursor() cur.execute('SELECT COUNT(1)') acom = 'SELECT * FROM IMGS WHERE LIKENUM > ' + str( self.least_likes) + ' AND TAG LIKE "%' + self.keyword + '%"' cur.execute(acom) tem = cur.fetchall() for i in tem: self.dataids.append(i[0]) saveimg.mkdir('dbimg') saveimg.mkdir('dbimg' + path_break + self.keyword + str(self.least_likes) + 'like') mkpath = 'dbimg' + path_break + self.keyword + str( self.least_likes) + 'like' if self.threads: self.new_threadsave(mkpath) elif self.async_able: saveimg.async_save(self.dataids, self.cookies, mkpath) else: saveimg.save(number=self.number, dataids=self.dataids, cookies=self.cookies, path=mkpath) print('DB Done')
def painter_bookmark_download(self): self.dataids = painter.getid2(img_id=self.id, cookies=self.cookies) saveimg.mkdir('painters') saveimg.mkdir('painters'+path_break+str(self.id)+'bookmark') mkpath = 'painters'+path_break+str(self.id)+'bookmark' if self.threads: self.new_threadsave(mkpath) elif self.async_able: saveimg.async_save(self.dataids, self.cookies, mkpath) else: self.save(dataids=self.dataids, cookies=self.cookies, path=mkpath) print('Painter\'s Bookmrak Done')
def painter_download(self): self.dataids = painter.getid(img_id=self.id, cookies=self.cookies) saveimg.mkdir('painters') saveimg.mkdir('painters' + path_break + str(self.id)) mkpath = 'painters' + path_break + str(self.id) if self.threads: self.new_threadsave(mkpath) elif self.async_able: saveimg.async_save(self.dataids, self.cookies, mkpath) else: saveimg.save(number=self.number, dataids=self.dataids, cookies=self.cookies, path=mkpath) print('Painter Done')
def daily_download(self): if self.sdate == '': mkpath = str(time.strftime('%Y-%m-%d', time.localtime(time.time()))) else: mkpath = str(self.sdate[0:4]+'-'+self.sdate[4:6]+'-'+self.sdate[6:]) self.dataids = daily.getid(r18=self.r18, date=self.date, cookies=self.cookies,types=self.types) saveimg.mkdir('ranking') # ranking saveimg.mkdir('ranking'+path_break+self.types+'img') # 调用函数 saveimg.mkdir('ranking'+path_break+self.types+'img'+path_break+mkpath+r18word(self.r18)) mkpath = 'ranking'+path_break+self.types+'img'+path_break+mkpath+r18word(self.r18) if self.threads: self.new_threadsave(mkpath) elif self.async_able: saveimg.async_save(self.dataids, self.cookies, mkpath) else: self.save(dataids=self.dataids, cookies=self.cookies, path=mkpath) print('Daily Done')
def super_daily_download(self): if self.date[4:6] in ['01','03','05','07','08','10','12']: end = 31 elif self.date[4:6] in ['04','06','09','11']: end = 30 elif int(self.date[:4]) % 4 == 0: end = 29 else: end = 28 mkpath = str(self.date[0:4]+'-'+self.date[4:6]) saveimg.mkdir('ranking') # ranking saveimg.mkdir('ranking'+path_break+self.types+'img') # 调用函数 saveimg.mkdir('ranking'+path_break+self.types+'img'+path_break+mkpath+r18word(self.r18)) mkpath = 'ranking'+path_break+self.types+'img'+path_break+mkpath+r18word(self.r18) date = self.date if False: threads = [] while date <= self.date[:6]+str(end): t = threading.Thread(target=daily.getid,args=(self.r18,date,self.cookies,self.types)) threads.append(t) date = str(int(date)+1) for t in threads: t.start() for t in tqdm.tqdm(threads): t.join(180) else: while date <= self.date[:6]+str(end): dataids = daily.getid(r18=self.r18, date=date, cookies=self.cookies,types=self.types) self.dataids = list(set(self.dataids).union(set(dataids))) print(date+' is done.') date = str(int(date)+1) if self.threads: self.new_threadsave(mkpath) elif self.async_able: saveimg.async_save(self.dataids, self.cookies, mkpath) else: self.save(dataids=self.dataids, cookies=self.cookies, path=mkpath) print('Daily Done')