Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name View Full Twitter Image
- // @version 2.0.1
- // @description Returns the full-size Twitter "orig" URL.
- // @match https://pbs.twimg.com/media/*
- // ==/UserScript==
- "use strict";
- function urlConvert(url) {
- const input = url.href;
- const regex = /media\/(.*)(?:\?|\.).*(jpg|png)/m;
- const match = input.match(regex);
- if(match === null) return;
- location.assign(`https://pbs.twimg.com/media/${match[1]}?format=${match[2]}&name=orig`);
- }
- const url = new URL(location);
- if(url.searchParams.get("format") && url.searchParams.get("name") === "orig") return;
- urlConvert(url);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement