Skip to content

To get media url from Bilibili, including both video and audio. Support page-splitted videos.

License

Notifications You must be signed in to change notification settings

InJeCTrL/BiliMediaUrlFetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BiliMediaUrlFetch

Why

最近在提取B站视频的音频流,看了下B站稿件的page-source带有单独视频流和单独音频流的url,所以弄个lambda function,方便以后再次提取。(主要是用用免费额度,整个方案不花钱)

How

  1. 创建Lambda Function

    Runtime选Python

    Architecture选x86_64(因为Github Actions在x86_64运行)

    建议启用function URL,方便使用

create_lambda

  1. 上传Lambda zipball

    Release 下载zip,上传替换Lambda Function源码

    upload_source

  2. 更改超时时间

    修改超时时间到半分钟左右,因为有分P的视频会顺序请求每个分片的信息,这里可能会超时

    exceed_time

  3. 使用function URL调试

    function_url

  4. 传入GET参数,查看效果

    URL schema: https://<function URL>/?bvid=<bvid>

    测试单一分片稿件的视频音频获取:(bvid=BV1VE421g7ya)

    test_single_page

    测试多分片稿件的视频音频获取:(bvid=BV1sV411Z7Cn)

    test_multiple_pages

  5. 获取媒体资源

    # 使用FFmpeg的同时带上含UA和Referer的请求头
    ffprobe -headers $'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0\r\nReferer: https://www.bilibili.com/\r\n' -i "<url you get>"

About

To get media url from Bilibili, including both video and audio. Support page-splitted videos.

Topics

Resources

License

Stars

Watchers

Forks

Languages