Last active
January 9, 2023 21:39
-
-
Save astronasutarou/8bf7ba454e12dc81822ac5fe21b3af1a to your computer and use it in GitHub Desktop.
amazon.co.jp の url から余分なものを取り去って綺麗にする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Amazon URL Cleaner | |
// @namespace http://xr0038.net | |
// @description Clean Amazon item URL | |
// @include http://www.amazon.co.jp*/dp/* | |
// @include https://www.amazon.co.jp*/dp/* | |
// @include http://www.amazon.co.jp*/gp/* | |
// @include https://www.amazon.co.jp*/gp/* | |
// @run-at document-start | |
// @version 1.2 | |
// ==/UserScript== | |
if (document.URL.match(/(dp|gp\/product)\/[A-Z0-9]{10}/g)) { | |
var newurl = document.URL.match(/https?:\/\/(|www\.)amazon\.(.+?)\//g) + document.URL.match(/(dp|gp\/product)\/[A-Z0-9]{10}/g); | |
console.log(newurl); | |
if (newurl != document.URL) location.replace(newurl); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment