Bloomberg - Paywall Bypass

Simple script to bypass the paywall on Bloomberg

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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() {}
    }
});