Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support the new BV tags #22

Open
yicong2007 opened this issue Mar 25, 2020 · 2 comments
Open

Please support the new BV tags #22

yicong2007 opened this issue Mar 25, 2020 · 2 comments

Comments

@yicong2007
Copy link

According to 【升级公告】AV号全面升级至BV号,the AV tags have been upgraded into BV tags.

The regular expression in lib/extractor.js

var REGEX_URL_VIDEO = /^https?:\/\/(?:www\.|bangumi\.|)bilibili\.(?:tv|com)\/(?:video\/av(\d+)(?:\/|\/index_(\d+)\.html)?)(?:\?p=(\d+).*)?$/i;

is outdated and the video id cannot be extracted so easily as before.

@catright
Copy link
Contributor

This is only a temporary solution and I'm using bilibili-get on windows node.js (v12.16.1). If your environment is similar to me, this solution may help you. I guess it'll work on the other environments too.
Please change following lines in extractor.js.

  • top of the file
// var REGEX_URL_VIDEO = /^https?:\/\/(?:www\.|bangumi\.|)bilibili\.(?:tv|com)\/(?:video\/av(\d+)(?:\/|\/index_(\d+)\.html)?)(?:\?p=(\d+).*)?$/i;
var REGEX_URL_VIDEO    = /^https?:\/\/(?:www\.|bangumi\.|)bilibili\.(?:tv|com)\/(?:video\/BV([A-Za-z\d]+)(?:\/|\/index_(\d+)\.html)?)(?:\?p=(\d+).*)?$/i;
  • var result = Object.assign({
// video_id: parseInt(REGEX_URL_VIDEO.exec(url)[1]),
video_id: REGEX_URL_VIDEO.exec(url)[1],
  • var findVideoInfo = function* ({ video_id, part_id, cookie }) {
// var data = yield fetchWebPage(`https://www.bilibili.com/video/${video_id}/` + (part_id ? `index_${part_id}.html` : ''), { cookie });
var data = yield fetchWebPage(`https://www.bilibili.com/video/BV${video_id}/` + (part_id ? `?p=${part_id}` : ''), { cookie });

@UlyssesZh
Copy link

+1 for the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants