Skip to content

Instantly share code, notes, and snippets.

@dotWee
Last active October 31, 2024 18:10
Show Gist options
  • Save dotWee/56ba0251f12f83710f7db40367fcfebe to your computer and use it in GitHub Desktop.
Save dotWee/56ba0251f12f83710f7db40367fcfebe to your computer and use it in GitHub Desktop.
UserScript to redirect .webp links to the equivalent .gif file url
// ==UserScript==
// @name Giphy webp to gif redirect
// @description Giphy: Redirect .webp links to the equivalent .gif file url
// @match *://*.giphy.com/media/*/giphy.webp
// @run-at document-start
// @inject-into content
// @version 1.1
// @author Lukas Wolfsteiner <https://lukas.wolfsteiner.media>
// @updateURL https://gist.github.com/dotWee/56ba0251f12f83710f7db40367fcfebe/raw/giphy_webp_to_gif_redirect.user.js
// @downloadURL https://gist.github.com/dotWee/56ba0251f12f83710f7db40367fcfebe/raw/giphy_webp_to_gif_redirect.user.js
// ==/UserScript==
function redirect_to_gif() {
let current_gif_url = location.href;
current_gif_url = current_gif_url.replace(/media\d/, "i").replace(".webp", ".gif");
console.log("Redirecting to: " + current_gif_url);
window.location.href = current_gif_url;
}
redirect_to_gif();
@dotWee
Copy link
Author

dotWee commented Oct 31, 2024

Click on the Raw button or here to install the UserScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment