[WORKING] Unlock any Medium Article

Unlock any paid article from Medium by using Freedium, only if the referer is not Freedium

目前為 2024-09-27 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         [WORKING] Unlock any Medium Article
// @namespace    https://github.com/insign
// @version      202409271707
// @description  Unlock any paid article from Medium by using Freedium, only if the referer is not Freedium
// @author       Hélio <[email protected]>
// @match        https://medium.com/*
// @grant        none
// @license      WTFPL
// ==/UserScript==

(function() {
    'use strict';

    // Obtém a URL atual
    var currentURL = window.location.href;

    // Obtém o referenciador (a página anterior que o usuário veio)
    var referrer = document.referrer;

    var shouldRedirect = true;

    if (referrer) {
        try {
            // Analisa a URL do referenciador para obter o hostname
            var referrerHost = (new URL(referrer)).hostname;

            // Verifica se o referenciador é freedium.cfd
            if (referrerHost === 'freedium.cfd') {
                shouldRedirect = false; // Não redireciona se veio do Freedium
            }
        } catch (e) {
            // Se não for possível analisar o referenciador, continua com o redirecionamento
            console.error('Erro ao analisar o referenciador:', e);
        }
    }

    if (shouldRedirect) {
        // Cria a nova URL redirecionada
        var freediumURL = 'https://freedium.cfd/' + currentURL;

        // Redireciona para a nova URL
        window.location.replace(freediumURL);
    }
})();