From 816c8c1109610008ba2270a4e36c87c0f9765e44 Mon Sep 17 00:00:00 2001 From: Beichen Liu Date: Sun, 11 Aug 2019 14:40:17 -0400 Subject: [PATCH 1/2] add multiple file download from selection usage: using *av number* or an url without video numbe, and give a number range from *first* to *last*(both are inclusive). --- bilibili_video_download_v3.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bilibili_video_download_v3.py b/bilibili_video_download_v3.py index a9c48f0..2306218 100644 --- a/bilibili_video_download_v3.py +++ b/bilibili_video_download_v3.py @@ -180,6 +180,9 @@ def combine_video(title_list): # https://www.bilibili.com/video/av46958874/?spm_id_from=333.334.b_63686965665f7265636f6d6d656e64.16 start_url = 'https://api.bilibili.com/x/web-interface/view?aid=' + re.search(r'/av(\d+)/*', start).group(1) + first = input("please enter the first video number: ") + last = input("please enter the last video number: ") + # 视频质量 # # @@ -196,6 +199,9 @@ def combine_video(title_list): # 单独下载分P视频中的一集 p = re.search(r'\?p=(\d+)',start).group(1) cid_list.append(data['pages'][int(p) - 1]) + elif first not 0 and last not 0: + for i in range(int(first), int(last)): + cid_list.append(data['pages'][i-1]) else: # 如果p不存在就是全集下载 cid_list = data['pages'] From f8a8dce7ee3aa5fb639eac9f7d8a681e95ddb12a Mon Sep 17 00:00:00 2001 From: Beichen Liu Date: Sun, 11 Aug 2019 19:24:37 -0400 Subject: [PATCH 2/2] fix typo --- bilibili_video_download_v3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bilibili_video_download_v3.py b/bilibili_video_download_v3.py index 2306218..13c5511 100644 --- a/bilibili_video_download_v3.py +++ b/bilibili_video_download_v3.py @@ -199,7 +199,7 @@ def combine_video(title_list): # 单独下载分P视频中的一集 p = re.search(r'\?p=(\d+)',start).group(1) cid_list.append(data['pages'][int(p) - 1]) - elif first not 0 and last not 0: + elif first != 0 and last != 0 and last >= first: for i in range(int(first), int(last)): cid_list.append(data['pages'][i-1]) else: