I can download the first episode of a series.
yutube-dl https://www.bilibili.com/video/av90163846?p=1
Now I want to download all episodes of the series.
for i in $(seq 1 55)
do
yutube-dl https://www.bilibili.com/video/av90163846?p=$i
done
All other episodes except the first can't be downloaded ,both of them contains same error info such as below:
[BiliBili] 90163846: Downloading webpage
[BiliBili] 90163846: Downloading video info page
[download] 【合集300集全】地道美音 美国中小学教学 自然科学 社会常识-90163846.flv has already been downloaded
Please have a try and check what happens,how to fix then?
@Christos Lytras,strange thing happen with your code:
for i in $(seq 1 55)
do
youtube-dl https://www.bilibili.com/video/av90163846?p=$i -o "%(title)s-%(id)s-$i.%(ext)s"
done
It surely can download video on bilibili,but all of downloaded video have different name and same content,all the content are the same as the first episode,have a try and check ,you will find that fact.
Navigate to https://y2mate.tv/ in your browser. Copy a link of Bilibili video and paste to the text field of the online Bilibili downloader. Hit the “Convert” button to analyze the video link. Click “Download MP3” or “Download MP4” (actually to FLV).
Enjoy watching it offline in high quality!
This error occurs because youtube-dl
ignores URI parameters after ?
for the filename, so the next file it tries to download has the same name with the previous one and it fails because a file already exists with that name. The solution is to use the --output
template filesystem option to set a filename which it'll have an index in its name using the variable i
.
Filesystem Options
-o, --output TEMPLATE Output filename template, see the "OUTPUT TEMPLATE" for all the info
OUTPUT TEMPLATE
The
-o
option allows users to indicate a template for the output file names.The basic usage is not to set any template arguments when downloading a single file, like in
youtube-dl -o funny_video.flv "https://some/video"
. However, it may contain special sequences that will be replaced when downloading each video. The special sequences may be formatted according to python string formatting operations. For example,%(NAME)s
or%(NAME)05d
. To clarify, that is a percent symbol followed by a name in parentheses, followed by formatting operations. Allowed names along with sequence type are:
id
(string): Video identifiertitle
(string): Video titleurl
(string): Video URLext
(string): Video filename extension
...
For your case, to use the i
in the output filename, you can use something like this:
for i in $(seq 1 55)
do
youtube-dl https://www.bilibili.com/video/av90163846?p=$i -o "%(title)s-%(id)s-$i.%(ext)s"
done
which will use the title
the id
the i
variable for indexing and the ext
for the video extension.
You can check the Output Template variables for more options defining the filename.
UPDATE
Apparently, bilibili.com has some Javascript involved to setup the video player and fetch the video files. There is no way so you can extract the whole playlist using youtube-dl
. I suggest you use Annie which supports Bilibili playlists out of the box. It has installers for all major operating systems and you can use it like this to download the whole playlist:
annie -p https://www.bilibili.com/video/av90163846
of if you want to download only until 55 video, you can use -end 55
cli option like this:
annie -end 55 -p https://www.bilibili.com/video/av90163846
You can use the
-start
,-end
or-items
option to specify the download range of the list:-start Playlist video to start at (default 1) -end Playlist video to end at -items Playlist video items to download. Separated by commas like: 1,5,6,8-10
For bilibili playlists only:
-eto File name of each bilibili episode doesn't include the playlist title
If you want to only get information of a playlist without downloading files, then use the -i
command line option like this:
annie -i -p https://www.bilibili.com/video/av90163846
will output something like this:
Site: 哔哩哔哩 bilibili.com
Title: 【合集300集全】地道美音 美国中小学教学 自然科学 社会常识 P1 【001】Parts of Plants
Type: video
Streams: # All available quality
[64] -------------------
Quality: 高清 720P
Size: 308.24 MiB (323215935 Bytes)
# download with: annie -f 64 ...
[32] -------------------
Quality: 清晰 480P
Size: 201.57 MiB (211361230 Bytes)
# download with: annie -f 32 ...
[16] -------------------
Quality: 流畅 360P
Size: 124.75 MiB (130809508 Bytes)
# download with: annie -f 16 ...
Site: 哔哩哔哩 bilibili.com
Title: 【合集300集全】地道美音 美国中小学教学 自然科学 社会常识 P2 【002】Life Cycle of a Plant
Type: video
Streams: # All available quality
[64] -------------------
Quality: 高清 720P
Size: 227.75 MiB (238809781 Bytes)
# download with: annie -f 64 ...
[32] -------------------
Quality: 清晰 480P
Size: 148.96 MiB (156191413 Bytes)
# download with: annie -f 32 ...
[16] -------------------
Quality: 流畅 360P
Size: 94.82 MiB (99425641 Bytes)
# download with: annie -f 16 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With