Skip to content

Instantly share code, notes, and snippets.

@Thunraz
Last active October 24, 2023 20:08
Show Gist options
  • Save Thunraz/b192d65d58c6eb93c762016f21c48f87 to your computer and use it in GitHub Desktop.
Save Thunraz/b192d65d58c6eb93c762016f21c48f87 to your computer and use it in GitHub Desktop.
Twitter to Nitter
// ==UserScript==
// @name Twitter to Nitter
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Redirects Twitter to a Nitter instance
// @author Thunraz <thunraz@thunraz.com>
// @match https://twitter.com/*
// @match https://x.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const nitterInstance = 'https://nitter.d420.de/';
const pattern = /https:\/\/(?:(?:twitter.com)|(?:x.com))\/(.*)/;
const queryString = document.location.href.match(pattern)[1];
document.location.href = nitterInstance + queryString;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment