Skip to content

Commit

Permalink
[bilibili] fixed space videos url detect
Browse files Browse the repository at this point in the history
  • Loading branch information
vcinly committed Nov 17, 2018
1 parent 64e1515 commit 470b74f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/you_get/extractors/bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,23 +399,16 @@ def download_video_from_totallist(url, page, **kwargs):
videotitle = videos[i]["title"]
videourl = "https://www.bilibili.com/video/av{}".format(videoid)
print("Start downloading ", videotitle, " video ", videotitle)
kwargs["output_dir"] = kwargs["output_dir"] + '/' + str(videoid)
download_cover(videos[i]['pic'], videotitle, **kwargs)
Bilibili().download_by_url(videourl, subtitle=videotitle, **kwargs)
if page <= jsonresult['pages']:
if page < jsonresult['data']['pages']:
page += 1
download_video_from_totallist(url, page, **kwargs)
else:
log.wtf("Fail to get the files of page " + jsonresult)
sys.exit(2)

else:
log.wtf("Fail to parse the fav title" + url, "")

def download_cover(url, title, **kwargs):
if re.match(r'https?:https://', url) is None:
url = 'https:' + url
download_urls([url], title, "jpg", 0, kwargs["output_dir"])
log.wtf("Fail to parse the video title" + url, "")

def bilibili_download_playlist_by_url(url, **kwargs):
url = url_locations([url], faker=True)[0]
Expand All @@ -435,7 +428,7 @@ def bilibili_download_playlist_by_url(url, **kwargs):
elif 'favlist' in url:
# this a fav list folder
download_video_from_favlist(url, **kwargs)
elif 'video' in url:
elif re.match(r'https?:https://space.bilibili.com/\d+/#/video', url):
download_video_from_totallist(url, 1, **kwargs)
else:
aid = re.search(r'av(\d+)', url).group(1)
Expand Down

0 comments on commit 470b74f

Please sign in to comment.