예제 #1
0
 def build_filename(self, p_title, i, ext, j=None):
     if self.p_len == 1:
         filename = f'{self.owner}-{self.title}({p_title}).{ext}'
     else:
         filename = f'{self.owner}-{self.title}(P{i}.{p_title}).{ext}'
     if j is not None:
         filename = f'[{j}]-{filename}'
     filename = f'{filename}.download'
     return PathUtil.join_path(CONFIG['DOWNLOAD_PATH'],
                               legitimize(filename))
예제 #2
0
 def download_video(self, url, filename):
     final_filename = PathUtil.join_path(CONFIG['DOWNLOAD_PATH'], filename)
     if PathUtil.check_path(final_filename):
         print(f'{final_filename} exists, stop downloading')
         return final_filename
     print(f'{filename} download start')
     request = BilibiliApi.build_video_download_request(url)
     response = RequestUtil.do_request(request, load_json=False)
     self.before_response(response)
     self.save_video(response.raw_response, final_filename)
     return final_filename