// ==UserScript== // @id BilibiliWatchlaterRedirect@Laster2800 // @name B站“稍后再看”重定向 // @version 1.4.20200715 // @namespace laster2800 // @author Laster2800 // @description B站“稍后再看”播放页重定向至常规播放页面 // @include *://www.bilibili.com/medialist/play/watchlater/* // @include *://www.bilibili.com/watchlater/* // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @connect api.bilibili.com // @run-at document-start // @downloadURL none // ==/UserScript== (function() { var v = GM_getValue('gm383441-20200714') if (!v) { var c = confirm(`来自【B站“稍后再看”重定向】:\n 该脚本已合并至【https://greasyfork.org/zh-CN/scripts/395456-b站-稍后再看-功能增强】,强烈建议进行迁移。\n 该提示点击【确认】后不再显示,一段时间后会自动升级并移除掉与该提示相关的无用代码,所以不必担心影响运行效率的问题。\n 如果只是希望最高效地使用重定向功能,大可忽略这个提示。`) if (c) { GM_setValue('gm383441-20200714', true) window.open('https://greasyfork.org/zh-CN/scripts/395456') } } if (/bilibili.com\/medialist\/play\/watchlater\//.test(location.href)) { window.stop() GM_xmlhttpRequest({ method: 'GET', url: `https://api.bilibili.com/x/v2/history/toview/web?jsonp=jsonp`, onload: function(response) { if (response && response.responseText) { try { var part = parseInt(location.href.match(/(?<=\/watchlater\/p)\d+(?=\/?)/)[0]) var json = JSON.parse(response.responseText) var watchList = json.data.list location.replace('https://www.bilibili.com/video/' + watchList[part - 1].bvid) } catch(e) { console.error('重定向错误,请联系脚本作者( https://greasyfork.org/zh-CN/scripts/383441/feedback ):\n' + e) } } } }) } })()