Bloomberg - Paywall Bypass

Simple script to bypass the paywall on Bloomberg

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Bloomberg - Paywall Bypass
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Simple script to bypass the paywall on Bloomberg
// @author       November2246
// @match        https://*.bloomberg.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bloomberg.com
// @grant        none
// @run-at       document-start
// @license      ISC
// ==/UserScript==

const { log, warn, error, debug } = window.console;

const subs = {
    BLOOMBERG_ALL: 'bbg-all',
    BLOOMBERG_DIGITAL: 'bbg-digital',
    BUSINESSWEEK_PRINT: 'bw-print',
    BUSINESSWEEK_DIGITAL: 'bw-digital',
    BUSINESSWEEK_ZINIO: 'bw-zinio'
};
const subStrings = Object.values(subs);

const _searchParamsGet = URLSearchParams.prototype.get;
URLSearchParams.prototype.get = function get() {
    let params = _searchParamsGet.apply(this, arguments);
    if (arguments[0] === 'mockSub') {
        return 'bbg';
    }
    if (arguments[0] === 'showPaywall') {
        return null;
    }
    return params;
}

const _arraySome = Array.prototype.some;
Array.prototype.some = function some() {
    let includesSubs = false;
    subStrings.forEach(str => {
        if (this.includes(str)) includesSubs = true;
    });
    if (includesSubs) return true;
    return _arraySome.apply(this, arguments);
}

Object.defineProperty(window, '_regUserInfo', {
    get() {
        return window._regUserInfo_;
    },
    set(v) {
        v.subscription = { type: 'BBW' };
        window._regUserInfo_ = v;
    }
});

Object.defineProperties(Object.prototype, {
    _isTerminalSubscriber: {
        get() {
            return true;
        },
        set() {}
    },
    _isBBGSubscriber: {
        get() {
            return true;
        },
        set() {}
    },
    _isBWSubscriber: {
        get() {
            return true;
        },
        set() {}
    }
});