Skip to content

Instantly share code, notes, and snippets.

@M-rcus
Last active May 5, 2020 04:55
Show Gist options
  • Save M-rcus/eeb3afcb549987ef9b79a8f953b34bf5 to your computer and use it in GitHub Desktop.
Save M-rcus/eeb3afcb549987ef9b79a8f953b34bf5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitter Images - New URL Format
// @description For better quality images
// @namespace https://github.com/M-rcus
// @author Marcus H
// @match https://pbs.twimg.com/media/*
// @grant none
// @version 1.1.2
// @updateUrl https://gist.githubusercontent.com/M-rcus/eeb3afcb549987ef9b79a8f953b34bf5/raw
// ==/UserScript==
const url = new URL(window.location.href);
const format = 'png';
const name = '4096x4096';
const params = url.searchParams;
if (params.get('format') !== format || params.get('name') !== name) {
const path = url.pathname.replace(/\.(jpg|png)((:large)?)$/, '');
window.location.href = url.origin + path + `?format=${format}&name=${name}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment