Skip to content

Commit

Permalink
📁层级功能bug修复
Browse files Browse the repository at this point in the history
  • Loading branch information
HFrost0 committed May 12, 2022
1 parent c3c4ee0 commit 924a8dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions bilix/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ async def get_series(self, url: str, quality: int = 0, image=False, subtitle=Fal
elif 'videoData' in init_info: # bv视频
if hierarchy:
title = legal_title(init_info['videoData']['title'])
hierarchy = self._make_hierarchy_dir(hierarchy, title) \
if len(init_info['videoData']['pages']) > 1 else None
if len(init_info['videoData']['pages']) > 1:
hierarchy = self._make_hierarchy_dir(hierarchy, title)
else:
hierarchy = hierarchy if type(hierarchy) is str else None
for idx, i in enumerate(init_info['videoData']['pages']):
p_url = f"{url}?p={idx + 1}"
add_name = f"P{idx + 1}-{i['part']}" if len(init_info['videoData']['pages']) > 1 else ''
Expand All @@ -352,8 +354,10 @@ async def get_series(self, url: str, quality: int = 0, image=False, subtitle=Fal
elif 'initEpList' in init_info: # 动漫,电视剧,电影
if hierarchy:
title = legal_title(re.search('property="og:title" content="([^"]*)"', res.text).groups()[0])
hierarchy = self._make_hierarchy_dir(hierarchy, title) \
if len(init_info['initEpList']) > 1 else None
if len(init_info['initEpList']) > 1:
hierarchy = self._make_hierarchy_dir(hierarchy, title)
else:
hierarchy = hierarchy if type(hierarchy) is str else None
for idx, i in enumerate(init_info['initEpList']):
p_url = i['link']
add_name = i['title']
Expand Down Expand Up @@ -410,7 +414,7 @@ async def get_video(self, url: str, quality: int = 0, add_name='', image=False,
return
cid = audio_urls[0].split('/')[-2]

file_dir = f'{self.videos_dir}/{hierarchy}' if hierarchy else self.videos_dir
file_dir = f'{self.videos_dir}/{hierarchy}' if hierarchy and len(hierarchy) > 0 else self.videos_dir
task_id = self.progress.add_task(
total=1,
description=title if len(title) < 43 else f'{title[:20]}...{title[-20:]}', visible=False)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_license():
setup(
name='bilix',
python_requires=">=3.8",
version='0.6.2',
version='0.6.3',
author='HFrost0',
author_email='hhlfrost@gmail.com',
description='⚡️快如闪电的b站视频下载工具,基于Python现代Async异步特性,高速批量下载整部动漫,电视剧,电影,up投稿等',
Expand Down

0 comments on commit 924a8dd

Please sign in to comment.