Skip to content

Instantly share code, notes, and snippets.

@corecode
Last active March 20, 2023 16:09
Show Gist options
  • Select an option

  • Save corecode/63d2f8fced904c6001931cd8b74a2ee5 to your computer and use it in GitHub Desktop.

Select an option

Save corecode/63d2f8fced904c6001931cd8b74a2ee5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Aliexpress URL Cleaner
// @run-at document-start
// @namespace
// @description Clean aliexpress item URL
// @match *://*.aliexpress.com/item/*
// @match *://*.aliexpress.com/store/product/*
// @version 1.2
// ==/UserScript==
(function() {
'use strict';
var p1 = document.URL.match(/^https?:\/\/(?:(?:..|www)[.])aliexpress[.]com\/(?:item|store\/product)(?=\/)/);
var p2 = document.URL.match(/\/[0-9_]+[.]html(?=$|[?])/);
if (p1 && p2 && p1+p2 != document.URL) history.replaceState(null, '', p1+p2);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment