Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 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')
Exemplo n.º 4
0
 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')
Exemplo n.º 5
0
    def get_pids(self):
        tag_list_page = requests.get(
            'https://www.pixiv.net/search.php?s_mode=s_tag_full&word=' +
            self.tag)
        pattern = re.compile('data-id="(\d*)"')
        # regular expression for pids of popular pics of specific tag

        return list(set(pattern.findall(
            tag_list_page.text))), saveimg.mkdir(tag=self.tag)
Exemplo n.º 6
0
 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)
     saveimg.mkdir('dailyimg')  # 调用函数
     saveimg.mkdir('dailyimg' + path_break + mkpath + r18word(self.r18))
     mkpath = 'dailyimg' + 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:
         saveimg.save(number=self.number,
                      dataids=self.dataids,
                      cookies=self.cookies,
                      path=mkpath)
     print('Daily Done')
Exemplo n.º 7
0
    def get_pids(self):
        date_url = ''
        # date_url being empty means show today's result

        if len(self.date):
            year, month, day = self.date.split('-')
            if datetime.date(year=int(year), month=int(month),
                             day=int(day)) < datetime.date.today():
                date_url = "&date=" + year + month + day
            else:
                self.date = str(datetime.date.today())

        daily_list_page = requests.get(
            'http://www.pixiv.net/ranking.php?mode=daily' + date_url)
        pattern = re.compile('data-id="(\d*)">')
        # regular expression for pids of daily pics

        return pattern.findall(
            daily_list_page.text), saveimg.mkdir(date=self.date)
Exemplo n.º 8
0
 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')