iawia002 / lux

👾 Fast and simple video download library and CLI tool written in Go
MIT License
27.86k stars 3k forks source link

[download fail]: Bilibili 无法下载“登录后可见”视频 #1126

Open lhy7889678 opened 2 years ago

lhy7889678 commented 2 years ago

Website name: Bilibili

OS:: Linux

Video URL:: https://www.bilibili.com/video/BV1jx41167BZ

Stack overflow

Downloading https://www.bilibili.com/video/BV1jx41167BZ error:
this page has no playlist
github.com/iawia002/lux/extractors/bilibili.getMultiPageData
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/bilibili/bilibili.go:158
github.com/iawia002/lux/extractors/bilibili.extractNormalVideo
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/bilibili/bilibili.go:168
github.com/iawia002/lux/extractors/bilibili.(*extractor).Extract
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/bilibili/bilibili.go:300
github.com/iawia002/lux/extractors.Extract
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/extractors.go:52
github.com/iawia002/lux/app.download
        /Users/iawia002/go/src/github.com/iawia002/lux/app/app.go:271
github.com/iawia002/lux/app.New.func1
        /Users/iawia002/go/src/github.com/iawia002/lux/app/app.go:248
github.com/urfave/cli/v2.(*App).RunContext
        /Users/iawia002/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:322
github.com/urfave/cli/v2.(*App).Run
        /Users/iawia002/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main
        /Users/iawia002/go/src/github.com/iawia002/lux/main.go:13
runtime.main
        /usr/local/Cellar/go/1.18.1/libexec/src/runtime/proc.go:250
runtime.goexit
        /usr/local/Cellar/go/1.18.1/libexec/src/runtime/asm_amd64.s:1571
github.com/iawia002/lux/extractors/bilibili.extractNormalVideo
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/bilibili/bilibili.go:170
github.com/iawia002/lux/extractors/bilibili.(*extractor).Extract
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/bilibili/bilibili.go:300
github.com/iawia002/lux/extractors.Extract
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/extractors.go:52
github.com/iawia002/lux/app.download
        /Users/iawia002/go/src/github.com/iawia002/lux/app/app.go:271
github.com/iawia002/lux/app.New.func1
        /Users/iawia002/go/src/github.com/iawia002/lux/app/app.go:248
github.com/urfave/cli/v2.(*App).RunContext
        /Users/iawia002/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:322
github.com/urfave/cli/v2.(*App).Run
        /Users/iawia002/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main
        /Users/iawia002/go/src/github.com/iawia002/lux/main.go:13
runtime.main
        /usr/local/Cellar/go/1.18.1/libexec/src/runtime/proc.go:250
runtime.goexit
        /usr/local/Cellar/go/1.18.1/libexec/src/runtime/asm_amd64.s:1571
github.com/iawia002/lux/extractors.Extract
        /Users/iawia002/go/src/github.com/iawia002/lux/extractors/extractors.go:54
github.com/iawia002/lux/app.download
        /Users/iawia002/go/src/github.com/iawia002/lux/app/app.go:271
github.com/iawia002/lux/app.New.func1
        /Users/iawia002/go/src/github.com/iawia002/lux/app/app.go:248
github.com/urfave/cli/v2.(*App).RunContext
        /Users/iawia002/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:322
github.com/urfave/cli/v2.(*App).Run
        /Users/iawia002/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main
        /Users/iawia002/go/src/github.com/iawia002/lux/main.go:13
runtime.main
        /usr/local/Cellar/go/1.18.1/libexec/src/runtime/proc.go:250
runtime.goexit
        /usr/local/Cellar/go/1.18.1/libexec/src/runtime/asm_amd64.s:1571

Screenshots

none

Additional context

该视频为“登录后可见”视频,无法下载(带上 cookie 也如此),提示 this page has no playlist。 (PS:被其他视频推荐过来的,本来以为是视频挂掉了,但转念一想,B 站应该不会主动给用户去推荐挂掉的视频,查阅资料后才发现这种视频是登录后可见……)

lim0513 commented 2 years ago

未见异常 image

lhy7889678 commented 2 years ago

进一步测试发现,使用 "name1=value1; ..." 形式的 cookie 可以下载,而 Netscape 格式的 cookie 文件无法下载: 图片 文件内容如下(已打码)

# Netscape HTTP Cookie File
# https://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file! Do not edit.

.bilibili.com   TRUE    /   FALSE   1668121200  rpdid   *************************
.bilibili.com   TRUE    /   FALSE   1716215038  buvid3  **********************************************
.bilibili.com   TRUE    /   FALSE   1661351039  _uuid   **********************************************
.bilibili.com   TRUE    /   FALSE   1669720637  video_page_version  v_old_home
.bilibili.com   TRUE    /   FALSE   1673088865  buvid_fp_plain  **********************************************
.bilibili.com   TRUE    /   FALSE   1673089428  b_ut    5
.bilibili.com   TRUE    /   FALSE   1737636002  buvid_fp    ********************************
.bilibili.com   TRUE    /   FALSE   1737725840  buvid4  ********************************************************************************
.bilibili.com   TRUE    /   FALSE   1684236214  fingerprint3    ********************************
.bilibili.com   TRUE    /   FALSE   1684236214  fingerprint ********************************
.bilibili.com   TRUE    /   FALSE   1685887026  nostalgia_conf  -1
.bilibili.com   TRUE    /   FALSE   1687533333  hit-dyn-v2  1
.bilibili.com   TRUE    /   FALSE   1689051631  CURRENT_QUALITY 0
#HttpOnly_.bilibili.com TRUE    /   FALSE   1673233548  SESSDATA    **********************************
.bilibili.com   TRUE    /   FALSE   1673233548  bili_jct    ********************************
.bilibili.com   TRUE    /   FALSE   1673233548  DedeUserID  *********
.bilibili.com   TRUE    /   FALSE   1673233548  DedeUserID__ckMd5   ****************
.bilibili.com   TRUE    /   FALSE   1689400617  i-wanna-go-back 2
.bilibili.com   TRUE    /   FALSE   1689400694  CURRENT_BLACKGAP    0
.bilibili.com   TRUE    /   FALSE   0   b_lsid  *********************
.bilibili.com   TRUE    /   FALSE   0   b_timer **************************************************************************
www.bilibili.com    FALSE   /   FALSE   0   theme_style light
.bilibili.com   TRUE    /   FALSE   0   sid ********
.bilibili.com   TRUE    /   FALSE   253402300799    PVID    1
.bilibili.com   TRUE    /   FALSE   1689647806  blackside_state 0
.bilibili.com   TRUE    /   FALSE   1689647806  CURRENT_FNVAL   4048
.bilibili.com   TRUE    /   FALSE   1660703965  bp_video_offset_526969266   undefined

这大概是另一个问题了,或许应该新开一个 issue?

fgr178707 commented 1 year ago

你的那个第2章那个是怎么导出的 手打的?

lhy7889678 commented 1 year ago

@fgr178707 Netscape 格式的是用这个浏览器插件导出的,更新到最新 release 版的 lux 和插件,问题依然存在。而 name1=value1; ... 格式的文本是用正则表达式替换的。