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.
Get cid from bilibili #20555
Get cid from bilibili #20555
Comments
|
@dstftw Can you modify it? thanks
|
|
@awei78 , I think it would be quicker if you go and edit the file in the code repository yourself which would automatically create a pull request that the maintainers can approve. We really need this bug fix applied. |
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like this:[x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2019.04.01. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.In the file bilibili.py, line 116, the code of get "cid" is:
cid = self._search_regex( r'\bcid(?:["\']:|=)(\d+)', webpage, 'cid', default=None ) or compat_parse_qs(self._search_regex( [r'EmbedPlayer\([^)]+,\s*"([^"]+)"\)', r'EmbedPlayer\([^)]+,\s*\\"([^"]+)\\"\)', r'<iframe[^>]+src="https://secure\.bilibili\.com/secure,([^"]+)"'], webpage, 'player parameters'))['cid'][0]If there is only one video on the page, it works fine. However, if the video is part of the list, such as url: https://www.bilibili.com/video/av4050443/?p=86
It's cid is: 6534658. part of it's data is: {"cid":6534658,"page":86,"from":"vupload"...}
Use Regex pattern r'\bcid(?:["']:|=)(\d+)', it only get the cid of the first video in the list, it is wrong.
Then I found, if there is only one video on the page, it video data like this: {"cid":45915709,"page":1,"from":"vupload"...}, That is, it has a page number.
So, I think, can pattern be changed? add a page number limit, suck as:
In this way, the correct cid can be achieved, and the whole playlist can be downloaded.
I am looking forward to it.