Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cannot download from bilibili, "no videos found" #10375
Comments
Bilibili now uses emscripten, which is very difficult for reverse engineering. I don't expect it to be fixed in near future, so I mark it as broken. Ref: #10375
|
For those who are interested in Bilibili: this website now uses emscripten, which (indirectly) compiles C/C++ to Javascript. I find it very difficult to analyze. If anyone know how to reverse emscripten-generated codes, please propose here. Thanks! |
|
from the mobile website, it possible to extract lower quality using |
|
So I reversed the bilibili signature generation, and here you can find a C# source code that takes a Bilibili video url and returns the stream URL. Meat of the decoding function is on bilibiliPlayer.min.js. It haves a VM that interprets emscripten bytecode like was said here before. It calculates the MD5 Hash of a string to generate the signature. Relevant stuff on this string includes the Video CId, an AppKey (different from the other ones used on the page it seems), and another bigger key that seems to be calculated from one of the "external" (from the VM point of view) Javascript functions. Worked with the few videos I tested here, if anyone try this out let me know if it's working too. Also if info on how to get the "constant" keys is needed too just let me know. Note: I guess that the keys change within different player versions (maybe?), will need to observe for some time to see. |
|
Amazing! I'll try to translate C# to Python.
It's common in Chinese websites. I have a set of scripts at https://github.com/yan12125/iqiyi-hack that extracts keys automatically by Selenium. It's originally written for Flash players, while it should not be difficult to add codes for Javascript-based players. |
|
@yan12125 The code is pretty simple and I added some comments too, should be easy to translate. Also interesting scripts you made, I'm not sure if the 128-bit key can be extracted "automatically" through, since it seems to be generated inside the VM (unless I missed something). It would probably be possible to extract it automatically by having a JavaScript engine running the player code, stopping the thing in the middle and grabbing the Key from the VM Heap, maybe. |
|
In previous cases, I patch the Flash player so that it posts the key to my server. Then I use an HTTP proxy to intercept requests to the main player. For Bilibili, I guess intercepting the MD5 function is a possible approach. |
|
Thanks to @gdkchan, BiliBili support will be back in the next version. |
|
@yan12125 how to patch the Flash player? |
|
@weituotian See https://github.com/yan12125/iqiyi-hack for details |
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like that [x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2016.08.17. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue
If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:
Add
-vflag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):