예제 #1
0
 def save_all_photos(self):
     # 获取所有帖子的链接
     tie_zi_urls = get_all_tie_zi_urls(self.url).get_tie_zi_urls()
     print('共有', len(tie_zi_urls), '个帖子')
     for tie_zi_url in tie_zi_urls:
         tie_zi_url = tie_zi_url + '?pn=1'
         save_one_tie_zi_photos().save_all_pages_photos(tie_zi_url)
         sleep(self.RANDOM_NUM)
예제 #2
0
파일: manage.py 프로젝트: sunlx688/tiebapic
 def start(self):
     tie_zi_num = 0
     tie_zi_urls = get_all_tie_zi_urls(self.url).get_tie_zi_urls()
     tie_zi_titles = get_all_tie_zi_urls(self.url).get_tie_zi_titles()
     while tie_zi_num < len(tie_zi_urls):
         photos_num = len(get_one_page_photo_urls(tie_zi_urls[tie_zi_num]).get_photo_urls())
         dir_name = tie_zi_titles[tie_zi_num]
         if photos_num == 0:
             tie_zi_num += 1
             continue
         else:
             dir().ch_dir(path)
             dir().make_dir(dir_name)
             new_path = self.path + dir_name
             dir().ch_dir(new_path)
             save_all_photos(self.url).save_all_photos()
             print('本帖子的名字为', dir_name, photos_num, new_path)
             tie_zi_num += 1