Greasy Fork

Greasy Fork is available in English.

百度网盘视频播放尊享 VIP | 解锁视频倍数 | 解锁全部清晰度

使用该脚本进入百度网盘视频播放页面,自动解锁 VIP 限制,可以使用 VIP 的绝大多数功能

当前为 2021-06-08 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)


// ==UserScript==
// @name            百度网盘视频播放尊享 VIP | 解锁视频倍数 | 解锁全部清晰度
// @namespace       https://timer.palerock.cn
// @version         0.1.0
// @description     使用该脚本进入百度网盘视频播放页面,自动解锁 VIP 限制,可以使用 VIP 的绝大多数功能
// @include         https://pan.baidu.com/play/video*
// @include         https://timer.palerock.cn/configuration*
// @author          Cangshi
// @run-at          document-start
// @grant           none
// ==/UserScript==

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.$hookBaiduPanVideo = {}));
}(this, (function (exports) { 'use strict';

  function _classCallCheck(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  }

  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }

  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
  }

  function _assertThisInitialized(self) {
    if (self === void 0) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }

    return self;
  }

  function _getPrototypeOf(o) {
    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
      return o.__proto__ || Object.getPrototypeOf(o);
    };
    return _getPrototypeOf(o);
  }

  function _superPropBase(object, property) {
    while (!Object.prototype.hasOwnProperty.call(object, property)) {
      object = _getPrototypeOf(object);
      if (object === null) break;
    }

    return object;
  }

  function _get(target, property, receiver) {
    if (typeof Reflect !== "undefined" && Reflect.get) {
      _get = Reflect.get;
    } else {
      _get = function _get(target, property, receiver) {
        var base = _superPropBase(target, property);
        if (!base) return;
        var desc = Object.getOwnPropertyDescriptor(base, property);

        if (desc.get) {
          return desc.get.call(receiver);
        }

        return desc.value;
      };
    }

    return _get(target, property, receiver || target);
  }

  function _setPrototypeOf(o, p) {
    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
      o.__proto__ = p;
      return o;
    };

    return _setPrototypeOf(o, p);
  }

  function _inherits(subClass, superClass) {
    if (typeof superClass !== "function" && superClass !== null) {
      throw new TypeError("Super expression must either be null or a function");
    }

    subClass.prototype = Object.create(superClass && superClass.prototype, {
      constructor: {
        value: subClass,
        writable: true,
        configurable: true
      }
    });
    if (superClass) _setPrototypeOf(subClass, superClass);
  }

  function _typeof(obj) {
    "@babel/helpers - typeof";

    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
      _typeof = function _typeof(obj) {
        return typeof obj;
      };
    } else {
      _typeof = function _typeof(obj) {
        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      };
    }

    return _typeof(obj);
  }

  function _possibleConstructorReturn(self, call) {
    if (call && (_typeof(call) === "object" || typeof call === "function")) {
      return call;
    }

    return _assertThisInitialized(self);
  }

  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var ConfigType;

  (function (ConfigType) {
    ConfigType["BOOLEAN"] = "boolean";
    ConfigType["STRING"] = "string";
    ConfigType["NUMBER"] = "number";
    ConfigType["SHORTCUT"] = "shortcut";
    ConfigType["LONG_STRING"] = "long_string";
    ConfigType["DATE"] = "date";
    ConfigType["COLOR"] = "color";
    ConfigType["ARRAY"] = "array";
    ConfigType["PICKLIST"] = "picklist";
    ConfigType["DUELING_PICKLIST"] = "dueling_picklist";
  })(ConfigType || (ConfigType = {}));

  function _arrayWithHoles(arr) {
    if (Array.isArray(arr)) return arr;
  }

  function _iterableToArrayLimit(arr, i) {
    var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);

    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;

    var _s, _e;

    try {
      for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
        _arr.push(_s.value);

        if (i && _arr.length === i) break;
      }
    } catch (err) {
      _d = true;
      _e = err;
    } finally {
      try {
        if (!_n && _i["return"] != null) _i["return"]();
      } finally {
        if (_d) throw _e;
      }
    }

    return _arr;
  }

  function _arrayLikeToArray$1(arr, len) {
    if (len == null || len > arr.length) len = arr.length;

    for (var i = 0, arr2 = new Array(len); i < len; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }

  function _unsupportedIterableToArray$1(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(o);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
  }

  function _nonIterableRest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  function _slicedToArray(arr, i) {
    return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
  }

  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }

  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

  var _window;

  function getWindow() {
    if (_window == null) {
      _window = typeof unsafeWindow === 'undefined' ? window : unsafeWindow;
    }

    return _window;
  }
  function isInIframe() {
    var is = getWindow().parent !== getWindow();

    try {
      is = is && getWindow().parent.document.body.tagName !== 'FRAMESET';
    } catch (e) {// ignore
    }

    return is;
  }
  var LOAD_MODULE = '__hooks_load_module';
  var LOAD_MODULE_PATH = '___hooks_preModules';
  var getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);
  Object.getPrototypeOf.bind(Object);
  var nativeObjects = [[Array.prototype], [Object, false]];

  function getMethodList(target) {
    var result = {};

    var _iterator = _createForOfIteratorHelper(getOwnPropertyNames(target)),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var name = _step.value;
        result[name] = target[name];
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }

    return result;
  }

  nativeObjects.map(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 1),
        nativeObject = _ref2[0];

    return [nativeObject, getMethodList(nativeObject)];
  });
  function requireToLoadModule(module) {
    if (!getWindow()[LOAD_MODULE]) {
      window[LOAD_MODULE_PATH] = window[LOAD_MODULE_PATH] || [];
      window[LOAD_MODULE_PATH].push(module);
    } else {
      getWindow().dispatchEvent(new CustomEvent(LOAD_MODULE, {
        detail: module
      }));
    }
  }

  var logger = {
    log: function log() {
      if (!isInIframe()) {
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }

        args.unshift('[TimerHook]');

        if (typeof GM_log === 'function') {
          GM_log(args.join(' '));
        } else {
          var _console;

          (_console = console).log.apply(_console, args);
        }
      }
    },
    warn: function warn() {
      if (!isInIframe()) {
        var _console2;

        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
          args[_key2] = arguments[_key2];
        }

        args.unshift('[TimerHook]');

        (_console2 = console).warn.apply(_console2, args);
      }
    }
  };

  var BasicModule = /*#__PURE__*/function () {
    function BasicModule() {
      _classCallCheck(this, BasicModule);

      _defineProperty(this, "host", void 0);

      _defineProperty(this, "isActive", false);

      _defineProperty(this, "isMountHost", false);
    }

    _createClass(BasicModule, [{
      key: "mountHost",
      value: function mountHost(host) {
        this.host = host;
        this.isMountHost = true;
        this.onMounted();
      }
    }, {
      key: "activate",
      value: function activate() {
        this.isActive = true;
        this.init();
      }
    }, {
      key: "deactivate",
      value: function deactivate() {
        this.isActive = false;
        this.onDestroy();
      }
    }, {
      key: "moduleName",
      get: function get() {
        return undefined;
      }
    }, {
      key: "priority",
      get: function get() {
        return 50;
      }
    }, {
      key: "autoActivate",
      get: function get() {
        return true;
      }
    }, {
      key: "isCoreModule",
      get: function get() {
        return false;
      }
    }, {
      key: "isOnlyOuterIframe",
      get: function get() {
        return false;
      }
    }, {
      key: "getDependencyModule",
      value: function getDependencyModule(moduleIdentityName) {
        if (this.host == null) {
          // logger.warn('This module [' + this.moduleIdentityName + '] is not mounted.')
          return undefined;
        }

        var targetModule = this.host.getModule(moduleIdentityName);

        if (targetModule && targetModule.moduleIdentityName) {
          return targetModule;
        } // logger.warn('Module not found:', moduleIdentityName)


        return undefined;
      }
    }, {
      key: "init",
      value: function init() {// to be override
      }
    }, {
      key: "onMounted",
      value: function onMounted() {// to be override
      }
    }, {
      key: "onDestroy",
      value: function onDestroy() {// to be override
      }
    }, {
      key: "declareConfigs",
      value: function declareConfigs() {
        return [];
      }
    }, {
      key: "setConfig",
      value: function setConfig(key, value) {
        var configs = this.getDependencyModule('configs');

        if (!configs || !configs.available()) {
          logger.warn('Config module not found, can\'t set configs values.');
        }

        configs.setValue(this.moduleIdentityName, key, value);
      }
    }, {
      key: "getConfig",
      value: function getConfig(key) {
        var _configs$getValue;

        var configs = this.getDependencyModule('configs');
        var defaultValue = (this.declareConfigs().find(function (config) {
          return config.key === key;
        }) || {})["default"];

        if (!configs || !configs.available()) {
          return defaultValue;
        }

        return (_configs$getValue = configs.getValue(this.moduleIdentityName, key)) !== null && _configs$getValue !== void 0 ? _configs$getValue : defaultValue;
      }
    }, {
      key: "window",
      get: function get() {
        return this.host ? this.host.getWindow() : getWindow();
      }
    }, {
      key: "document",
      get: function get() {
        return this.window.document;
      }
    }]);

    return BasicModule;
  }();

  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  var targetLocals = ['loc', 'als'].join('');
  var proxyLocals = ['locals', 'back'].join('_');

  var BaiduPanVideo = /*#__PURE__*/function (_BasicModule) {
    _inherits(BaiduPanVideo, _BasicModule);

    var _super = _createSuper(BaiduPanVideo);

    function BaiduPanVideo() {
      var _this;

      _classCallCheck(this, BaiduPanVideo);

      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      _this = _super.call.apply(_super, [this].concat(args));

      _defineProperty(_assertThisInitialized(_this), "hasInit", false);

      return _this;
    }

    _createClass(BaiduPanVideo, [{
      key: "moduleIdentityName",
      get: function get() {
        return 'baiduPanVideo';
      }
    }, {
      key: "moduleName",
      get: function get() {
        return '百度网盘视频 VIP';
      }
    }, {
      key: "init",
      value: function init() {
        _get(_getPrototypeOf(BaiduPanVideo.prototype), "init", this).call(this);

        if (!this.hasInit) {
          this.applyVipRoles();
          this.hasInit = true;
        }
      }
    }, {
      key: "priority",
      get: function get() {
        return 0;
      }
    }, {
      key: "getConfigMapper",
      value: function getConfigMapper(keys) {
        var _this2 = this;

        return keys.reduce(function (result, key) {
          result[key] = _this2.getConfig(key);
          return result;
        }, {});
      }
    }, {
      key: "getterMapper",
      get: function get() {
        return this.getConfigMapper(['hitvideosample']);
      }
    }, {
      key: "setterMapper",
      get: function get() {
        return this.getConfigMapper(['is_vip', 'is_svip', 'is_evip', 'show_vip_ad', 'vip_level']);
      }
    }, {
      key: "applyVipRoles",
      value: function applyVipRoles() {
        var innerWindow = this.window;
        var getterMapper = this.getterMapper;
        var setterMapper = this.setterMapper;
        Object.defineProperty(innerWindow, targetLocals, {
          get: function get() {
            var get = innerWindow[proxyLocals].get;

            innerWindow[proxyLocals].get = function () {
              var args = Array.prototype.slice.call(arguments);

              if (args.length > 1) {
                var callback = args[args.length - 1];

                args[args.length - 1] = function () {
                  var innerArgs = Array.prototype.slice.call(arguments);
                  innerArgs.forEach(function (arg, i) {
                    if (args[i] in getterMapper) {
                      innerArgs[i] = getterMapper[args[i]];
                    }
                  });
                  return callback.apply(this, innerArgs);
                };
              } else if (args[0] in getterMapper) {
                return getterMapper[args[0]];
              }

              return get.apply(this, args);
            };

            return innerWindow[proxyLocals];
          },
          set: function set(value) {
            innerWindow[proxyLocals] = value;
            var set = innerWindow[proxyLocals].set;

            innerWindow[proxyLocals].set = function () {
              var keys = Object.keys(setterMapper);

              if (keys.includes(arguments[0])) {
                arguments[1] = setterMapper[arguments[0]];
              }

              return set.apply(this, arguments);
            };
          }
        });
      }
    }, {
      key: "declareConfigs",
      value: function declareConfigs() {
        return [{
          key: 'is_vip',
          "default": true,
          type: ConfigType.BOOLEAN,
          title: '普通 VIP'
        }, {
          key: 'is_svip',
          "default": true,
          type: ConfigType.BOOLEAN,
          title: '超级 VIP'
        }, {
          key: 'is_evip',
          "default": true,
          type: ConfigType.BOOLEAN,
          title: '临时 VIP'
        }, {
          key: 'show_vip_ad',
          "default": true,
          type: ConfigType.BOOLEAN,
          title: '播放 VIP 广告'
        }, {
          key: 'hitvideosample',
          "default": true,
          type: ConfigType.BOOLEAN,
          title: '使用 VIP 播放器'
        }, {
          key: 'vip_level',
          "default": 7,
          type: ConfigType.NUMBER,
          title: '用户 VIP 等级'
        }];
      }
    }]);

    return BaiduPanVideo;
  }(BasicModule);

  var baiduPanVideo = new BaiduPanVideo();
  requireToLoadModule(baiduPanVideo);
  baiduPanVideo.init();

  exports.baiduPanVideo = baiduPanVideo;

  Object.defineProperty(exports, '__esModule', { value: true });

})));