webketje / Business Insider Subscribed

// ==UserScript==
// @name         Business Insider Subscribed
// @namespace    https://openuserjs.org/users/webketje
// @version      1.0.0
// @description  Read businessinsider.com articles as if you were subscribed (without paywall).
// @author       webketje
// @license      MIT
// @tag          news
// @downloadURL  https://openuserjs.org/install/webketje/Business_Insider_Subscribed.min.user.js
// @updateURL    https://openuserjs.org/meta/webketje/Business_Insider_Subscribed.meta.js
// @homepageURL  https://gist.github.com/webketje/fd7b8d4a979acc064a6930cc5d1dbc68
// @supportURL   https://gist.github.com/webketje/fd7b8d4a979acc064a6930cc5d1dbc68#comments
// @match        https://www.businessinsider.com/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAilBMVEUAK/8AKv/////5+v/f5P+gsP8uUP+erv+Mn//6+/9Vcf/v8v8LM/+JnP93jf+SpP9BYP8hRv+otv84Wf9rg/9ziv/x8//a4P8ELf/R2f8nS//e4/9HZf/w8v8oS/9+k/+EmP9Nav8zVf9EY/+Yqf9jff/O1v8HMP/29/+XqP8QN/8wUv8qTf8lSf+3fcZoAAAAAXRSTlP89O1mUQAAAAFiS0dEAmYLfGQAAAAJcEhZcwAAAS4AAAEuAXtxGk0AAAAHdElNRQfnCwkQIQq9IaCMAAAAi0lEQVQ4y2NgYMQLGAjIA1WMLAVMYMDMwsoG5LADmRxYFQABJxcBBUzcPDgV8PLxMwMpAZwKBBkZhYCUME4FIlyiYkxM4hL43SApRcCR0jKMeBzJKwsMCzl8jpQHUgo4FSgqKUsCKRUCAcWkSkCBmjpeBRqaWth9oQwB2uogjg6QpUv/FDWgCghlfwDm5grxsnvYjQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMy0xMS0wOVQxNjozMzoxMCswMDowMNmPnUUAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjMtMTEtMDlUMTY6MzM6MTArMDA6MDCo0iX5AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAFd6VFh0UmF3IHByb2ZpbGUgdHlwZSBpcHRjAAB4nOPyDAhxVigoyk/LzEnlUgADIwsuYwsTIxNLkxQDEyBEgDTDZAMjs1Qgy9jUyMTMxBzEB8uASKBKLgDqFxF08kI1lQAAAABJRU5ErkJggg==
// @grant        unsafeWindow
// @run-at       document-start
// @noframes
// ==/UserScript==

(function (global) {
  'use strict';
  var offendingUrl = '/ajax/render-component?path=paywall/template'

  var cachedFetch = global.fetch
  global.fetch = function (url, options) {
    if (url === offendingUrl) {
      const nopaywall = { query: { path: 'paywall/template' }, rendered: '<div></div>' }
      global.fetch = cachedFetch
      return Promise.resolve(nopaywall)
    }
    return cachedFetch(url, options)
  }
})(unsafeWindow || window);