希望增加“用mpv播放”的按钮 #1762
Lee-7723
started this conversation in
功能建议 / Ideas
希望增加“用mpv播放”的按钮
#1762
Replies: 3 comments 27 replies
-
网页不能直接跑cmd的, 你可以弄个批处理之类的 (类似 #1472) |
Beta Was this translation helpful? Give feedback.
24 replies
-
按照你上面的格式, 可以这么弄一个脚本: (不过我没 mpv 所以没测过能不能运行) // ==UserScript==
// @name mpv 播放
// @version 1.0.0
// @author Grant Howard
// @match https://www.bilibili.com/video/*
// @grant unsafeWindow
// ==/UserScript==
;(async () => {
if (!unsafeWindow.bilibiliEvolved) {
unsafeWindow.bilibiliEvolved = {}
}
if (!unsafeWindow.bilibiliEvolved.downloadVideoExtensionButtons) {
unsafeWindow.bilibiliEvolved.downloadVideoExtensionButtons = []
}
unsafeWindow.bilibiliEvolved.downloadVideoExtensionButtons.push({
name: 'mpv',
displayName: 'mpv 播放',
batch: false,
action: video => {
const urls = video.fragments.map(it => it.url).join('@')
const link = `mpv-bilibili://bilibili?url=${urls}`
window.open(link)
}
})
})() 文档: https://github.com/the1812/Bilibili-Evolved/blob/preview/doc/download-video-extensions.md |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
MPV播放器系列(一)-剪辑在线视频-知乎
刷知乎的时候刷到了这篇文章,提到
mpv是我的主力播放器,本身自带了youtube-dl,但是直接用命令
mpv "https://www.bilibili.com/video/BVxxxxxxxx(B站视频链接)"
这样的方法的话,youtube-dl要先解析再播放,解析的时间有点长,而且youtube-dl本身我写了config文件,导致功能设置有点混乱,不太好用
另一种方法是用B站视频直链,希望增加的也是这个功能
B站的直链应该是加上Referer和User-Agent就能用了吧(我一萌新,说错了别打我),正好mpv支持指定Referer和User-Agent
mpv的相关的操作说明
举例写法是:
mpv --http-header-fields='referer:https://www.bilibili.com/','user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 Edg/90.0.818.39' "https://cn-tj2-cmcc-bcache-08.bilivideo.com/upgcxcode/03/08/327030803/327030803-1-116.flv?e=ig8euxZM2rNcNbRjhbdVhwdlhWTghwdVhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1618994931&gen=playurlv2&os=bcache&oi=3746057939&trid=981785f4d159442ea0ff8a6585885155u&platform=pc&upsig=c7a11cd17258281c6216e4ef07195f66&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,platform&cdnid=6779&mid=310265481&orderid=0,3&agrr=1&logo=80000000"
我试了一下,完美播放
所以功能设想是:
获取视频直链,然后生成一条cmd命令
mpv --http-header-fields='referer:https://www.bilibili.com/','user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 Edg/90.0.818.39' "<direct video url>"
一个按钮执行命令,这样把视频拉取到mpv看(当然前提是mpv在环境路径里)
这功能的用户可能会比较少,但是应该不难写吧(站着说话不腰疼😁),希望增加这样的一个按钮
Beta Was this translation helpful? Give feedback.
All reactions