Open ShiYaya opened 4 months ago
直接获取视频自带的字幕文件,可以看源码
调用对应的接口返回的字幕列表一直是空的一般是啥原因了。 subtitle: { allow_submit: false, list: [] },
可能没登录
哪里找字幕列表的接口
哪里找字幕列表的接口 源码里面提供的接口如下: if (aidOrBvid.toLowerCase().startsWith('av')) {//avxxx aid = aidOrBvid.slice(2) pages = await fetch(
https://api.bilibili.com/x/player/pagelist?aid=${aid}
, {credentials: 'include'}).then(res => res.json()).then(res => res.data) cid = pages[0].cid title = pages[0].part await fetch(https://api.bilibili.com/x/player/v2?aid=${aid}&cid=${cid}
, {credentials: 'include'}).then(res => res.json()).then(res => { subtitles = res.data.subtitle.subtitles }) } else {//bvxxx await fetch(https://api.bilibili.com/x/web-interface/view?bvid=${aidOrBvid}
, {credentials: 'include'}).then(res => res.json()).then(async res => { title = res.data.title aid = res.data.aid cid = res.data.cid pages = res.data.pages }) await fetch(https://api.bilibili.com/x/player/v2?aid=${aid}&cid=${cid}
, {credentials: 'include'}).then(res => res.json()).then(res => { subtitles = res.data.subtitle.subtitles }) }
可能没登录
非常感谢,我这边的使用场景是用puppeteer库爬虫b站,对应的Cookei是添加了。调用https://api.bilibili.com/x/web-interface/view和https://api.bilibili.com/x/player/v2?aid=${aid}&cid=${cid}接口获取的数据 subtitle: { allow_submit: false, list: [] },一直是空。这里有什么注意的事项吗比如Cookei的参数规则或者其他的啥参数。 cookies 设置列表 const cookies = [ { name: 'CURRENT_FNVAL', value: '4048', domain: cookiesUrl1 }, { name: 'CURRENT_QUALITY', value: '0', domain: cookiesUrl1 }, { name: 'DedeUserID', value: '1346563215', domain: cookiesUrl1 }, { name: 'DedeUserID__ckMd5', value: '74755907f7742ea1', domain: cookiesUrl1 }, { name: 'FEED_LIVE_VERSION', value: 'V8', domain: cookiesUrl1 }, { name: 'PVID', value: '1', domain: cookiesUrl1 }, { name: 'SESSDATA', value: '8850ddb1%2C1729908610%2C3adfd%2A41CjCPOt_h7Gp5UsWsM4SaL3IHEyeob_9k9xF68A4aMmdDn-Ltl6AySI-PV-kRfa6lsdUSVmxfd2VpWGpoS1RIUTJzX1ZjdzFZZEs5bk9XRUt2SkV6RGlkSklRQV9oVjhiQ2ZtcmgwNUdVY0pkRndIT2hJWGF1MUlRMmhYbmFPdldCXzBEN2tvbVlRIIEC', domain: cookiesUrl1 }, { name: '_uuid', value: '2D1022D52-7FC7-51052-C3B6-DB415D518F1E17831infoc', domain: cookiesUrl1 }, { name: 'b_lsid', value: "6DA8410C2_18F286A9A21", domain: cookiesUrl1 }, { name: 'b_nut', value: '1711952316', domain: cookiesUrl1 }, { name: 'buvid_fp_plain', value: 'undefined', domain: cookiesUrl1 }, { name: 'enable_web_push', value: 'DISABLE', domain: cookiesUrl1 }, { name: 'fingerprint', value: '3fdb06817a92b84e7316e39a1a08da65', domain: cookiesUrl1 }, { name: 'header_theme_version', value: 'CLOSE', domain: cookiesUrl1 }, { name: 'home_feed_column', value: '5', domain: cookiesUrl1 }, { name: 'bp_video_offset_1346563215', value: '920647439888678934', domain: cookiesUrl1 }, { name: 'i-wanna-go-back', value: '-1', domain: cookiesUrl1 }, { name: 'is-2022-channel', value: '1', domain: cookiesUrl1 }, { name: 'rpdid', value: "|(u)~l)k~l)Y0J'u~uumlkJRk", domain: cookiesUrl1 }, { name: 'bili_ticket', value: 'eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTQwMjQ2MDUsImlhdCI6MTcxMzc2NTM0NSwicGx0IjotMX0.4_ZIo4Jn9hR61OckCFKtQoKT2iWTEmaf23JvIQdqkYA', domain: cookiesUrl1 }, { name: 'sid', value: '4gmcuedx', domain: cookiesUrl1 }, { name: 'buvid3', value: '71B9C8A7-26EC-62EE-22C3-98DE3E16718D16299infoc', domain: cookiesUrl1}, { name: 'b_ut', value: '7', domain: cookiesUrl1 }, { name: 'buvid4', value: '3DB868A7-3F9D-5FB0-EE4C-6569E08ECE2917317-024040106-jLwchfaVZkZJEFWdQUIaJQ%3D%3D', domain: cookiesUrl1 }, { name: 'buvid_fp', value: '3fdb06817a92b84e7316e39a1a08da65', domain: cookiesUrl1 }, { name: 'bsource', value: 'search_bing', domain: cookiesUrl1 }, { name: 'bili_jct', value: 'c1781d1f3d517675008bae0a830eaeae', domain: cookiesUrl1 }, { name: 'browser_resolution', value: '1912-966', domain: cookiesUrl1 }, { name: 'bili_ticket_expires', value: '1714615755', domain: cookiesUrl1 }, { name: 'bp_t_offset_1346563215', value: '6d1c6320%2C1729318219%2Cc4508%2A41CjCyb-920647439888678934', domain: cookiesUrl1 }, { name: 'bp_t_offset_1346563215', value: '6d1c6320%2C1729318219%2Cc4508%2A41CjCyb-920647439888678934', domain: cookiesUrl1 }, ];
可能没登录
非常感谢,我这边的使用场景是用puppeteer库爬虫b站,对应的Cookei是添加了。调用https://api.bilibili.com/x/web-interface/view和https://api.bilibili.com/x/player/v2?aid=${aid}&cid=${cid}接口获取的数据 subtitle: { allow_submit: false, list: [] },一直是空。这里有什么注意的事项吗比如Cookei的参数规则或者其他的啥参数。 cookies 设置列表 const cookies = [ { name: 'CURRENT_FNVAL', value: '4048', domain: cookiesUrl1 }, { name: 'CURRENT_QUALITY', value: '0', domain: cookiesUrl1 }, { name: 'DedeUserID', value: '1346563215', domain: cookiesUrl1 }, { name: 'DedeUserID__ckMd5', value: '74755907f7742ea1', domain: cookiesUrl1 }, { name: 'FEED_LIVE_VERSION', value: 'V8', domain: cookiesUrl1 }, { name: 'PVID', value: '1', domain: cookiesUrl1 }, { name: 'SESSDATA', value: '8850ddb1%2C1729908610%2C3adfd%2A41CjCPOt_h7Gp5UsWsM4SaL3IHEyeob_9k9xF68A4aMmdDn-Ltl6AySI-PV-kRfa6lsdUSVmxfd2VpWGpoS1RIUTJzX1ZjdzFZZEs5bk9XRUt2SkV6RGlkSklRQV9oVjhiQ2ZtcmgwNUdVY0pkRndIT2hJWGF1MUlRMmhYbmFPdldCXzBEN2tvbVlRIIEC', domain: cookiesUrl1 }, { name: '_uuid', value: '2D1022D52-7FC7-51052-C3B6-DB415D518F1E17831infoc', domain: cookiesUrl1 }, { name: 'b_lsid', value: "6DA8410C2_18F286A9A21", domain: cookiesUrl1 }, { name: 'b_nut', value: '1711952316', domain: cookiesUrl1 }, { name: 'buvid_fp_plain', value: 'undefined', domain: cookiesUrl1 }, { name: 'enable_web_push', value: 'DISABLE', domain: cookiesUrl1 }, { name: 'fingerprint', value: '3fdb06817a92b84e7316e39a1a08da65', domain: cookiesUrl1 }, { name: 'header_theme_version', value: 'CLOSE', domain: cookiesUrl1 }, { name: 'home_feed_column', value: '5', domain: cookiesUrl1 }, { name: 'bp_video_offset_1346563215', value: '920647439888678934', domain: cookiesUrl1 }, { name: 'i-wanna-go-back', value: '-1', domain: cookiesUrl1 }, { name: 'is-2022-channel', value: '1', domain: cookiesUrl1 }, { name: 'rpdid', value: "|(u)~l)k~l)Y0J'u~uumlkJRk", domain: cookiesUrl1 }, { name: 'bili_ticket', value: 'eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTQwMjQ2MDUsImlhdCI6MTcxMzc2NTM0NSwicGx0IjotMX0.4_ZIo4Jn9hR61OckCFKtQoKT2iWTEmaf23JvIQdqkYA', domain: cookiesUrl1 }, { name: 'sid', value: '4gmcuedx', domain: cookiesUrl1 }, { name: 'buvid3', value: '71B9C8A7-26EC-62EE-22C3-98DE3E16718D16299infoc', domain: cookiesUrl1}, { name: 'b_ut', value: '7', domain: cookiesUrl1 }, { name: 'buvid4', value: '3DB868A7-3F9D-5FB0-EE4C-6569E08ECE2917317-024040106-jLwchfaVZkZJEFWdQUIaJQ%3D%3D', domain: cookiesUrl1 }, { name: 'buvid_fp', value: '3fdb06817a92b84e7316e39a1a08da65', domain: cookiesUrl1 }, { name: 'bsource', value: 'search_bing', domain: cookiesUrl1 }, { name: 'bili_jct', value: 'c1781d1f3d517675008bae0a830eaeae', domain: cookiesUrl1 }, { name: 'browser_resolution', value: '1912-966', domain: cookiesUrl1 }, { name: 'bili_ticket_expires', value: '1714615755', domain: cookiesUrl1 }, { name: 'bp_t_offset_1346563215', value: '6d1c6320%2C1729318219%2Cc4508%2A41CjCyb-920647439888678934', domain: cookiesUrl1 }, { name: 'bp_t_offset_1346563215', value: '6d1c6320%2C1729318219%2Cc4508%2A41CjCyb-920647439888678934', domain: cookiesUrl1 }, ];
要带什么参数不清楚,因为扩展是运行在网页内,简单的通过credentials: 'include',就可以让浏览器把所有cookie都带上。
请问您是采取什么方法获得视频字幕的?是采用了某些ASR模型吗?