{"id":13430564,"url":"https://github.com/AndersonPlus/bilibili-service","last_synced_at":"2025-04-06T16:31:54.009Z","repository":{"id":172468037,"uuid":"601607147","full_name":"AndersonPlus/bilibili-service","owner":"AndersonPlus","description":"提供B站的弹幕和视频下载服务，只需输入B站视频的bvid即可获取下载超清以上的高画质视频和弹幕池信息！！！","archived":false,"fork":false,"pushed_at":"2025-01-20T01:41:13.000Z","size":124,"stargazers_count":32,"open_issues_count":1,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T03:31:42.370Z","etag":null,"topics":["bilibili-api","bilibili-download","nodejs","python3","spider","video-streaming"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndersonPlus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-14T12:36:37.000Z","updated_at":"2025-02-05T21:02:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"2364adbc-ee7b-4ab2-9dab-36e166fba611","html_url":"https://github.com/AndersonPlus/bilibili-service","commit_stats":null,"previous_names":["niyuancheng/bilibili-service","nova-js/bilibili-service","andersonplus/bilibili-service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonPlus%2Fbilibili-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonPlus%2Fbilibili-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonPlus%2Fbilibili-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonPlus%2Fbilibili-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndersonPlus","download_url":"https://codeload.github.com/AndersonPlus/bilibili-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247512814,"owners_count":20950938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bilibili-api","bilibili-download","nodejs","python3","spider","video-streaming"],"created_at":"2024-07-31T02:00:55.188Z","updated_at":"2025-04-06T16:31:54.002Z","avatar_url":"https://github.com/AndersonPlus.png","language":"JavaScript","funding_links":[],"categories":["下载工具"],"sub_categories":["直播脚本"],"readme":"# bilibili-service\n提供B站的弹幕和视频流服务，只需输入B站视频的bvid即可获取对应视频的视频流和弹幕池信息\n\n## 更新！！\n公网体验地址：http://47.101.212.31/getVideoData?bvid=(bvid)\nP.S. 目前该ip地址早已因服务器过期而不可用\n__提供最高画质原版视频同时支持免费下载！！！__\n## 使用方式\n1. 首先将项目clone到本地，运行```pnpm i```命令初始化。\n2. 找到index.js文件，运行```node index.js```\n3. 到B站上找到你喜欢视频的bvid，接着在浏览器访问本地服务```https://127.0.0.1?getVideoData=(bvid)```\n4. 接着你就会看到对应bvid的视频就已经完成下载并且在浏览器端播放了：\n__PS，确保你本地已经安装好了python和ffmpeg，具体安装方式可自行google__\n### 这是原视频：\n![image](https://user-images.githubusercontent.com/69229785/218935232-dc6201a2-97cd-437e-b2f2-c4e4af9db63c.png)\n### 本地启用服务后，输入该视频bvid\n![image](https://user-images.githubusercontent.com/69229785/218935373-6f210436-eba7-468f-b027-adcb149da588.png)\n### 接着等待片刻后，我们就可以看到视频已经加载成功了：\n![image](https://user-images.githubusercontent.com/69229785/218936313-484377b6-b01a-4400-8b3b-ed1f13476902.png)\n### 对应后台的文件已经下载到本地：\n![image](https://user-images.githubusercontent.com/69229785/218936185-38c5215f-f4fa-4580-8eb3-36420a90a090.png)\n\n\n\n## 视频bvid获取步骤\n所谓的bvid很好获取，首先找到你喜欢的视频播放页面，右击选择_复制视频地址_：\u003cbr /\u003e\n![image](https://user-images.githubusercontent.com/69229785/218742193-8524c3fd-66ab-44e4-9542-269046d926af.png)\u003cbr/\u003e\n接着我们会获得如下的地址：\n```txt\nhttps://www.bilibili.com/video/BV1Ud4y1V79P?t=0.7\n```\n其中的BV1Ud4y1V79P就是该视频的bvid，其余视频也是同理。\n\n## 数据\n1. B站获取到的弹幕池数据是xml类型的文本：\n![image](https://user-images.githubusercontent.com/69229785/218742618-791d200b-8642-4ff6-91d6-9f939cb56242.png)\n2. 视频流数据不是单纯的mp4文件，因为B站使用的是MPEG-DASH流媒体协议，因此获取的视频数据是json文本格式，其中的组织形式类似于manifest文件，描述的类似于每一个视频和音频分片的数据，例如分辨率，地址，大小，码率等；后缀名为m4s；如下图：\n![image](https://user-images.githubusercontent.com/69229785/218743610-0c92ec8d-b9b2-4dc0-9ce6-bec8f037bc25.png)\n\n## 弹幕数据解析\n本项目提供了对B站弹幕文件的解析，我们可以看到B站的弹幕文件每一个弹幕都是包裹着\u003cd\u003e。。。。\u003c/d\u003e,其中的p就是描述了弹幕的属性。\u003cbr /\u003e\n![image](https://user-images.githubusercontent.com/69229785/218744551-4cc0dea4-e1dd-4576-8e51-a001ee52df29.png)\n- 参数1（227.02100）：弹幕出现的时间，以秒数为单位\n- 参数2（1）：弹幕的模式，1-3 滚动弹幕，4 底端弹幕，5顶端弹幕，6 逆向弹幕，7 精准定位，8 高级弹幕\n- 参数3（25）：字号 （12非常小，16特小，18小，25中，36大，45很大，64特别大）\n- 参数4（9033215）：字体的颜色；这串数字是十进制表示；通常软件中使用的是十六进制颜色码；\n           e.g:\n           白色   \n           RGB值：(255,255,255)     \n           十进制值：16777215      \n           十六进制值：#FFFFFF\n- 参数5（1673862377）：unix时间戳，从1970年1月1日（UTC/GMT的午夜）开始所经过的秒数\n- 参数6（0）：弹幕池，0普通池，1字幕池，2特殊池 【目前特殊池为高级弹幕专用】\n- 参数7（91b2bf5a）：发送者的ID，用于“屏蔽此弹幕的发送者”功能\n- 参数8（1231205872512908544）：弹幕在弹幕数据库中rowID 用于“历史弹幕”功能。\n\n## B站API接口\n1. 获取视频aid: https://api.bilibili.com/x/player/pagelist?bvid=(bvid)\n2. 获取视频cid: https://api.bilibili.com/x/web-interface/view?cid=${cvid}\u0026bvid=${bvid}\n3. 获取对应视频的弹幕池文件： https://api.bilibili.com/x/v1/dm/list.so?oid=(cvid)\n4. 获取视频流文件（多种清晰度）：https://api.bilibili.com/x/player/playurl?fnval=80\u0026avid=${avid}\u0026cid=${cvid}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndersonPlus%2Fbilibili-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAndersonPlus%2Fbilibili-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndersonPlus%2Fbilibili-service/lists"}