Last active
January 12, 2026 09:24
-
-
Save astronasutarou/8bf7ba454e12dc81822ac5fe21b3af1a to your computer and use it in GitHub Desktop.
amazon.co.jp の url から余分なものを取り去って綺麗にする
This file contains hidden or 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.co.jp URL Cleaner | |
| // @author Ryou Ohsawa | |
| // @namespace https://gist.github.com/astronasutarou/ | |
| // @description Clean Amazon item URL | |
| // @include https://www.amazon.co.jp*/dp/* | |
| // @include https://www.amazon.co.jp*/gp/* | |
| // @include https://www.amazon.co.jp/*/gp/* | |
| // @include https://www.amazon.co.jp/*/dp/* | |
| // @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