Tweet Sneak Tampermonkey Script

Twitter now requires an account to view tweets & presents a log in screen if you attempt to open any tweet link in your browser.
After enabling this script you will be able to read the tweet without being annoyed by login screen.

How to use this script

  1. Install the Tampermonkey extension for your browser.
  2. Click on the Tampermonkey extension icon and choose "Create a new script".
  3. Replace the default script template with the code provided below
  4. Save the script.
  5. Try opening any tweet link in your browser, for eg this

Script

// ==UserScript==
// @name         Twitter Sneak
// @namespace    none
// @version      1.0
// @description  Twitter now requires an account to view tweets, this is a little tool to evade log in overhead. Turn off uBO to make this work
// @match        https://twitter.com/*/status/*
// @grant        none
// @author      .sh
// ==/UserScript==

(function() {
    'use strict';
    const tweetIdMatch = window.location.href.match(/\/status\/(\d+)/);
    const tweetId = tweetIdMatch ? tweetIdMatch[1] : '';
    const containerDiv = document.createElement('div');
    containerDiv.style.display = 'flex';
    containerDiv.style.flexDirection = 'column';
    containerDiv.style.alignItems = 'center';
    containerDiv.style.marginTop = '2rem';
    const heading = document.createElement('h1');
    heading.textContent = 'Tweet Sneak';
    heading.style.fontFamily = '"Segoe UI", Tahoma, Geneva, Verdana, sans-serif';
    heading.style.fontSize = '5rem'
    heading.style.textAlign = 'center';
    containerDiv.appendChild(heading);
    const tweetIframe = document.createElement('iframe');
    tweetIframe.src = `https://platform.twitter.com/embed/Tweet.html?id=${tweetId}`;
    tweetIframe.style.width = '550px';
    tweetIframe.style.height = '500px';
    containerDiv.appendChild(tweetIframe);
    document.body.innerHTML = '';
    document.body.style.backgroundColor = '#f5f8fa';
    document.body.appendChild(containerDiv);
    const footer = document.createElement('div');
    footer.style.marginTop = '20px';
    footer.innerHTML = 'Click <a href="https://tweetsneak.pages.dev" target="_blank">here</a> to use web version';
    footer.style.fontFamily = '"Segoe UI", Tahoma, Geneva, Verdana, sans-serif';
    footer.style.fontSize = 'large'
    containerDiv.appendChild(footer);
})();

Disable uBO

Disable uBlock Origin for this script to work. And take note that this script has been created primarily for Firefox. It may or may not work in other browsers & I didn't bother to test.

Web Version

You can also try its web version

Edit
Pub: 02 Jul 2023 09:43 UTC
Edit: 17 Jul 2023 06:10 UTC
Views: 1375