Last active
November 7, 2024 22:59
-
-
Save mathix420/e0604ab0e916622972372711d2829555 to your computer and use it in GitHub Desktop.
Bypass Medium Paywall - Working late 2023 - Greasy Fork, Violentmonkey, Tampermonkey - Click the RAW button to install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Medium Paywall Bypass | |
// @namespace Violentmonkey Scripts | |
// @run-at document-start | |
// @match *://*.medium.com/* | |
// @match *://medium.com/* | |
// @match *://*/* | |
// @grant none | |
// @version 2.4 | |
// @inject-into content | |
// @updateURL https://gist.githubusercontent.com/mathix420/e0604ab0e916622972372711d2829555/raw/medium.user.js | |
// @downloadURL https://gist.githubusercontent.com/mathix420/e0604ab0e916622972372711d2829555/raw/medium.user.js | |
// @website https://freedium.cfd | |
// @author Mathix420, ZhymabekRoman | |
// @description Don't forget to remove `@match` filters you don't want. | |
// ==/UserScript== | |
// initCall is telling us if we need to inject the title observer | |
function mediumRedirecter(initCall = false) { | |
if ( | |
// Allow seeing original articles that were already redirected to freedium. | |
!window.location.href.endsWith('#bypass') && | |
// Do not redirect when editing on medium. | |
!window.location.href.includes("/edit?source=") && | |
// Detect if we are on a medium website (regardless of the domain) | |
document.head?.querySelector('meta[property="al:android:url"]')?.content?.includes('medium://p/') | |
) { | |
window.location.href = 'https://freedium.cfd/' + window.location.href; | |
} else if (initCall && /(.*\.|^)medium\.com$/.test(window.location.host)) { | |
// Observe <title> changes | |
new MutationObserver(function(mutations) { | |
// If title change is detected, check if a freedium redirect is required | |
if (mutations[0].target.textContent) mediumRedirecter(); | |
}).observe( | |
document.querySelector('title'), | |
{ subtree: true, characterData: true, childList: true } | |
); | |
} | |
} | |
mediumRedirecter(true); |
@zzJinux if you want you can fork this gist and update it so I can replicate your changes
@mathix420 Just a few lines change: https://gist.github.com/zzJinux/364725e7c61810719286d94e88a4e38c I haven't had any issues.
Guys, sorry, yeah I known that's my fault. I need your help: Freedium-cfd/web#16 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mathix420 I have already locally patched the script to add the predicate. I hope your version will do so.