Download videos (and popup comments) from bilibili.com

Just found a nice website that analyzes the video path and so we could download the videos that are on bilibili.com! As of today when I post this, the webpage ibilibili.com is still alive.

06/05/2017: Something to note. Member-only videos (non public videos) cannot be downloaded right now. Keyword test: 다운로드, 下载, 下載, ダウンロード, descargar, скачать, ดาวน์โหลด

The Ultimate Solution

Hi all, I have been looking for a reliable solution for so long. I've been searching since 2015, and it never really gives a reliable solution. After struggling for a while, here I give you the ultimate solution to run on your PC. Using it as a web service is possible, but it'll be too costly to maintain. Given my financial condition I cannot afford that.

Anyway, the essential steps are simple. As some people are confused about the procedure, let me make this clearer. Don't give up on trying! (08/12/2017)

  • Install Python 3 and reboot your computer
    • Download from https://www.python.org/downloads/
    • For MacOS/Linux users, just reboot
    • For Windows users, remember to check "Add python.exe to Path" before you install, something like shown below
  • If you use Linux or Mac OS, open up a terminal
    • Run the following command:
      sudo pip3 install you-get
    • If pip3 does not exist, try replacing that with just pip
  • If you use Windows, open up the command window as Administrator
    • Run the following command:
      python.exe -m pip install you-get
    • Example from Hiki
    • If it says command not found, see if you install with "Add python.exe to Path"
    • If already added to path, then try or email me at yz at 9pm dot me for trouble shooting
      python -m pip install you-get
  • Download the video by:
    you-get [Bilibili link]

For more installation guidelines, please visit here.

For example:

# to look for video information
you-get -di http://www.bilibili.com/video/av854324/
# if the link contains multiple videos, use ?p=xx for individual video
you-get -di http://www.bilibili.com/video/av854324/?p=65

The output looks like

site:                Bilibili
title:               古风恒久远,良曲永流传【古风合集】
streams:             # Available quality and codecs
    [ DEFAULT ] _________________________________
    - format:        flv
      container:     flv
      size:          18.9 MiB (19853917 bytes)
    # download-with: you-get --format=flv [URL]
    - format:        hdmp4
      container:     mp4
      size:          18.7 MiB (19559025 bytes)
    # download-with: you-get --format=hdmp4 [URL]
    - format:        mp4
      container:     mp4
      size:          15.1 MiB (15827299 bytes)
    # download-with: you-get --format=mp4 [URL]

So if you want to download mp4, then run

you-get --format=mp4 http://www.bilibili.com/video/av854324/index_65.html

And a real example from Hiki:

Q & A & Trouble Shooting

Q1: Where did I download my file?

The downloaded video will be located at whichever folder you run you-get. Below is a brief example how to browse folders in terminal.

For Windows: (anything after # means comments)

C:\WINDOWS\System32\> dir  # list files in current folder
C:\WINDOWS\System32\> D:   # change to D disk
D:\> cd xxx_folder_name   # change to xxx_folder_name
D:\xxx_folder_name\> cd .. # change back to upper folder
D:\> you-get http://xxxxx

For MacOS (or Linux):

~$ ls                  # list files in current folder
~$ cd xxx_folder_name  # change to xxx_folder_name
~$ cd ..               # change back to upper folder
~$ pwd                 # know current folder path
~$ you-get http://xxxxx

Q2: I'm getting UTF-8 locale issues.

you-get: [error] oops, the current environment does not seem to support Unicode.
you-get: please set it to a UTF-8-aware locale first,
you-get: so as to save the video (with some Unicode characters) correctly.
you-get: you can do it like this:
you-get: (Windows) % chcp 65001
you-get: (Linux) $ LC_CTYPE=en_US.UTF-8

Kyo posted this. What you need to do is to run the following as soon as you open the terminal:

  • For MacOS or Linux
    export LC_CTYPE=en_US.UTF-8
    
  • For Windows
    C:\Windows\System32\cmd.exe /K chcp 65001
    

Q3: Why there is error downloading through a link?

Recently Bilibili has taken down most of its videos due to pirating issues.

01/15/2018: If you have encountered 403 or 466 error, use the following as a temporary solution:

pip3 install --upgrade https://github.com/ygmpkk/you-get/archive/develop.zip

To convert back later when the merge is approved, go back to the original version via:

pip3 install --upgrade https://github.com/soimort/you-get/archive/master.zip

Note: if you find issues downloading the video, try to update you-get using the following command:

pip3 install --upgrade https://github.com/rosynirvana/you-get/archive/master.zip

Also, this method support many other services like Youku, YouTube, Daily Motion, etc. All supported sites are listed here.

Let me know if you get any questions.

About Downloading Member-Only Videos at Bilibili

Some videos are member-only and currently there are no good ways to bypass that and download them. To view the videos, you have to become a member, answering 20-ish questions correctly. They are all in Chinese so you need to know a bit about the language. You cannot copy the words directly since they are embedded in the image. To answer the questions, if you can type in Chinese/Japanese, you can go to https://www.zhengjie.com/ to find answers as suggested by findaaaiba. Or you could purchase bilibili account through taobao.

Re-Organized again 🙂 (10/30/2016 05/29/2017 07/15/2017)

Re-organized contents. Since BH-5 is dead for now, I moved it to later parts of the article. Also thank "kimo" for providing an alternative method, but it seems vdYoutube.com failed on me.

As the ultimate solution is presented, I will no longer implement my own solution. This solution is on GitHub and is well maintained by many people. If ever the service is down, it can be quickly fixed, either by the developers, or by me. Thank you all for being with me for 2 years. 🙂

I can't believe I'm still updating this post, after 3 years :O (08/30/2018)

220 comments

  1. Wow thank you so much for this tutorial :D!! Do you know other websites which are similar to this? where it has lots of japanese tv show ; u ; )?

  2. Thank you so much for this tutorial! The usual online video downloaders I'm using can't even detect the video on bilibili. Bless you 🙂

  3. thank you for this tips, i can download the video.
    but why flv format can't download, i have tried it but i can't download
    thank you very much

    1. I believe this free service has some bugs to fix as others have reported similar things. I sent the developer messages already and hopefully he could update them asap. Meanwhile, enjoy other videos on bilibili 🙂

    1. I think they buffered the links. It might contain only 3 links before, and possibly the guy added two more videos but the parsing webpage doesn't do it in real time. I have contacted the site author and he'll take a look at this.

  4. HI!!!! i have been looking for ways to download videos on billibili with IDM and i am so happy i found your tutorial thank you so much man bless you!

  5. I've found when I use this method to download longer videos (50-ish minute tv shows), the file will cut off partway through. Any fix for that? Thanks so much!

  6. sorry i still confused. where i can download the video? i've done to write 'i' . but not works? i must open which website for download video? thanks..

    1. Hi there. When you add 'i' you should be able to get to a webpage (in Chinese) that shows "手机视频" (mobile video, mp4 format) and "高清视频" (HD video, flv format). Just click either one to download the video. And it seems "mobile video" is more robust than HD video parsing.

  7. is there any limit to download using this method? at first, it worked but the next video seems like i need to register/have VIP account..

    1. I don't think so. They don't have such limitations as far as I know (tried 10 videos and all are downloadable). How many you have tried? Maybe try to clear your browser cache and then parse the link.

  8. Wow... it actually worked! Thanks so much! People seem to upload all the good Japanese TV shows on this website such as Music Station and it doesn't get taken down quickly. However, it's still good to be able to save them. 🙂

    Thanks again.

      1. Same thing is replied to moon.. I think they buffered the links. It might contain only 3 links before, and possibly the guy added two more videos but the parsing webpage doesn't do it in real time. I have contacted the site author and he'll take a look at this.

Leave a comment

Your email address will not be published. Required fields are marked *