// ==UserScript== // @name 百度网盘视频跳转(自动跳转)-不需安装UA agent // @namespace http://tampermonkey.net/ // @match https://pan.baidu.com/ // @match https://pan.baidu.com/* // @exclude *://pan.baidu.com/disk/* // @version 0.2 // @description (2020122修改-适应了新链接)自动将百度网盘视频链接从play转换为pfile,方便下载。支持新的视频链接格式。(比如https://pan.baidu.com/play/video?_at_=1705936554287#/video?path=%2F%E5%9B%BE%E7%89%87%E5%B7%A5%E5%85%B7%E7%AE%B1-%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B%2F01.%E5%AF%BC%E5%85%A5%E5%9B%BE%E7%89%87.mp4&t=-1) // @author Yolanda Morgan // @license Yolanda Morgan // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; //如果是play,跳转到pfile if (window.location.href.startsWith("https://pan.baidu.com/play/video#/video?path")) { var url = window.location.href; var newUrl = url.replace("/play/video#", "/pfile"); window.location.href = newUrl; } else if (window.location.href.startsWith("https://pan.baidu.com/play")) { // 新的视频链接格式 var urla = window.location.href; var pathIndex = urla.indexOf("path=") + 5; var tIndex = urla.indexOf("t=") + 2; var path = urla.substring(pathIndex, urla.indexOf("&", pathIndex)); var t = urla.substring(tIndex, urla.length); var newUrla = "https://pan.baidu.com/pfile/video?path=" + path + "&t=" + t; window.location.href = newUrla; } })();