Skip to content

Commit

Permalink
Merge branch 'fix_bilibili_api' into 1.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	bilix/__init__.py
  • Loading branch information
HFrost0 committed Sep 20, 2024
2 parents 0239d33 + 1ed9342 commit d92ed43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bilix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Lighting-fast async download tool inspired by w
"""

__version__ = "1.0a5"
__version__ = "1.0a6"
__url__ = "https://github.com/HFrost0/bilix"
4 changes: 2 additions & 2 deletions bilix/sites/bilibili/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class VideoInfo(BaseModel):


def _parse_bv_html(url, html: str) -> VideoInfo:
init_info = re.search(r'<script>window.__INITIAL_STATE__=({.*});\(', html).groups()[0] # this line may raise
init_info = re.search(r'<script>window.__INITIAL_STATE__=({.*?});\(', html).groups()[0] # this line may raise
init_info = json.loads(init_info)
if len(init_info.get('error', {})) > 0:
raise APIResourceError("视频已失效", url) # 啊叻?视频不见了?在分区下载的时候可能产生
Expand All @@ -382,7 +382,7 @@ def _parse_bv_html(url, html: str) -> VideoInfo:
pages.append(Page(p_name=p_name, p_url=p_url))
# extract dash and flv_url
dash, other = None, []
play_info = re.search('<script>window.__playinfo__=({.*})</script><script>', html).groups()[0]
play_info = re.search('<script>window.__playinfo__=({.*?})</script><script>', html).groups()[0]
play_info = json.loads(play_info)['data']
try:
dash = Dash.from_dict(play_info)
Expand Down

0 comments on commit d92ed43

Please sign in to comment.