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

[bilibili]how can i download video on page2? #16870

Closed
kesdoputr opened this issue Jun 30, 2018 · 15 comments
Closed

[bilibili]how can i download video on page2? #16870

kesdoputr opened this issue Jun 30, 2018 · 15 comments

Comments

@kesdoputr
Copy link

@kesdoputr kesdoputr commented Jun 30, 2018

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.06.25. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.06.25

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

I try to use youtube-dl to download a video on bilibili like https://www.bilibili.com/video/av18178195

The video have 2 pages, but when i type youtube-dl -f 1 https://www.bilibili.com/video/av18178195
i just get the video on page1, how can i get video on page2?
I have see this page #16354
but i use
youtube-dl -f 1 https://www.bilibili.com/video/av18178195/index_2.html or
youtube-dl -f 1 https://www.bilibili.com/video/av18178195/?p=2

It will get the same video on page1
How can i solve this problem? Thank you.
Is this problem fixed? I use the standalone exe version.

@lss4
Copy link

@lss4 lss4 commented Jul 8, 2018

#16354 (need to also apply the regex fix 61cb668) doesn't appear to work. It still could only get the videos from the first page.

@yonhee137
Copy link

@yonhee137 yonhee137 commented Jul 12, 2018

when video-download.co was still able to download bilibili, this is what I used to get the page 2
/index_1.html#page=1

I havent's tried using youtube-dl for bilibili, does it really work now?

@kesdoputr
Copy link
Author

@kesdoputr kesdoputr commented Jul 12, 2018

@yonhee137
I try to use youtube-dl -f 1 https://www.bilibili.com/video/av18178195/index_2.html#page=2, but it seems still download files one page 1
Any way, thank you for your replay :)

@miklast
Copy link

@miklast miklast commented Jul 26, 2018

the fix that atxalex posted in #16354 will correct the issue for you. I am currently using it with 100% success.

@kesdoputr
Copy link
Author

@kesdoputr kesdoputr commented Jul 27, 2018

@miklast
Thanks for your information, but when i use the bilibili.py, i still can't download page2, and when i want to download page1 it says video is hidden.

Test url:https://www.bilibili.com/video/av18178195
The video have 2part (I test with just url, /index_1.html, /index_2.html, the result is the same)

●by original bilibili.py

C:\Users\k7\Desktop>youtube-dl -F https://www.bilibili.com/video/av18178195
[BiliBili] 18178195: Downloading webpage
[BiliBili] 18178195: Downloading video info page
[download] Downloading playlist: [中字] 斉藤朱夏 沼津一日警察署長 活動完整片段
[BiliBili] playlist [中字] 斉藤朱夏 沼津一日警察署長 活動完整片段: Collected 3
ideo ids (downloading 3 of them)
[download] Downloading video 1 of 3
[info] Available formats for 18178195_part1:
format code  extension  resolution note
0            flv        unknown
1            flv        unknown    108.34MiB (best)
[download] Downloading video 2 of 3
[info] Available formats for 18178195_part2:
format code  extension  resolution note
0            flv        unknown
1            flv        unknown    56.90MiB (best)
[download] Downloading video 3 of 3
[info] Available formats for 18178195_part3:
format code  extension  resolution note
0            flv        unknown
1            flv        unknown    126.81MiB (best)
[download] Finished downloading playlist: [中字] 斉藤朱夏 沼津一日警察署長 活動
完整片段

●by modified bilibili.py from #16354

C:\Users\k7\Desktop>youtube-dl -F https://www.bilibili.com/video/av18178195
[BiliBili] 18178195: Downloading webpage
[BiliBili] 18178195: Downloading video info page
[BiliBili] 18178195: Downloading video info page
ERROR: BiliBili said: Video is hidden.

Or i have some wrong? I just get the bilibili.py from #16354
and replace the original one.

@lss4
Copy link

@lss4 lss4 commented Jul 27, 2018

@miklast How to correctly apply that proposed fix from the current version? This line (from atxalex's proposed fix):

mobj[e[1]] = e[0]

doesn't look right as I'm getting: "TypeError: '_sre.SRE_Match' object does not support item assignment".

@Jaqen00
Copy link

@Jaqen00 Jaqen00 commented Aug 8, 2018

@kesdoputr
I find that I can download page2 and page3,but when I download page1 it says video is hidden,
and file in page 2 that I download is actually the content in page 1.
So I read the code .

In line 134: 'cid = mobj[int(page)-1] or ' ,I replace the line to 'cid = mobj[int(page)] or '

I don't know why ,but It actually worked for me .

@miklast
Copy link

@miklast miklast commented Aug 8, 2018

Sorry i didnt come back to this sooner @kesdoputr @lss4 4

Im not going to lie, im not the best with github/recompiling/python, so i had a friend help me out. Here's what mine looks like from line 132-141:

if 'anime/' not in url:
          mobj = re.findall(r'cid(?:["\']:|=)(\d+)', webpage)
          seen_mobj = set()
          mobj = [c for c in mobj if int(c) > 10 and not (c in seen_mobj or seen_mobj.add(c))]
          print(mobj)
          cid = mobj[int(page) - 1] 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]

Hope this helps. Ill try to respond quicker if theres any other issues.

edit 4 or whatever: this may help too, its the full code for Bilibili.py with changes.
https://hastebin.com/foyutuyimo.py

@Jaqen00
Copy link

@Jaqen00 Jaqen00 commented Aug 8, 2018

@miklast 谢谢老哥!

@kesdoputr
Copy link
Author

@kesdoputr kesdoputr commented Aug 8, 2018

@miklast
Oh thanks, the py you provide works.

@kesdoputr kesdoputr closed this Aug 8, 2018
@ohperhaps
Copy link

@ohperhaps ohperhaps commented Sep 29, 2018

@miklast Thanks sincerely!

@melody4eye
Copy link

@melody4eye melody4eye commented Dec 3, 2018

@miklast can you tell me how to put the new bilibili.py in that exe version. I am totally new to this. Thank you

@ytdl-org ytdl-org deleted a comment from melody4eye Dec 3, 2018
@vinqin
Copy link

@vinqin vinqin commented Apr 11, 2019

@miklast It works, thanks a lot.

@lss4
Copy link

@lss4 lss4 commented Apr 16, 2019

I can confirm the version from jasonszang works. It downloaded the video I wanted to download correctly... Hope this can be merged to mainstream.

Also, I do wish if it's also possible to download entire playlist from bilibili. I know it's already possible to do so with YouTube.

@ilovejs
Copy link

@ilovejs ilovejs commented May 10, 2019

[BiliBili] 17843872: Downloading webpage
ERROR: Unable to extract player parameters; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):

@ytdl-org ytdl-org deleted a comment from awei78 Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.