Amazon short URL

Replace article URL with short Amazon permalink

< Feedback on Amazon short URL

Review: Good - script works

§
Posted: 2018-11-14
Edited: 2018-11-14

short url script but for eBay & ETSY ?

Hi! Congrats for this must-have script.
Are you able to create one for eBay & ETSY too ?

Only this workaround is available so far…

eBay copy short url button https://greasyfork.org/fr/scripts/17528-ebay-copy-short-url-button

All the best!

GraphenAuthor
§
Posted: 2018-11-24
Edited: 2018-12-07

Hi Freshhh,

sorry for the delay. Just quickly made those for you, so they are not bulletproof. But should work. Let me know.

Try this for Ebay:

// ==UserScript==
// @name         eBay short url
// @namespace    graphen
// @version      1.2.0
// @description  Replaces long url by short url.
// @author       Ariel Jannai, graphen
// @include      /^https:\/\/www\.(be(fr|nl)\.)?ebay\.(at|ca|cn|vn|ie|it|nl|ph|pl|es|ch|de|fr|be|co\.(uk|th)|com(\.(au|hk|my|sg|tw))?)\/itm\/.*/
// @run-at       document-end
// @icon         https://cdn4.iconfinder.com/data/icons/flat-brand-logo-2/512/ebay-128.png
// @grant        none
// @license      MIT
// ==/UserScript==

/* jshint esversion: 6 */
(function(){
    'use strict';

    function tryShortUrl(url) {
        var urlPattern = /(be(fr|nl)\.)?ebay\.(at|ca|cn|vn|ie|it|nl|ph|pl|es|ch|de|fr|be|co\.(uk|th)|com(\.(au|hk|my|sg|tw))?)\/itm\//;

        if(urlPattern.test(url)) {
            var itmId = url.match(/\/(\d{12})(\?|$)/)[1];
            return 'https://www.' + urlPattern.exec(url)[0] + itmId;
        } else {
            return url;
        }
    }

    var url = String(window.location.href);
    history.replaceState(null, 'Shortened Ebay URL', tryShortUrl(url));

})();

Try this for Etsy:

// ==UserScript==
// @name         Etsy short url
// @namespace    graphen
// @version      1.1.0
// @description  Replaces long url by short url.
// @author       graphen
// @include      https://www.etsy.com/*
// @run-at       document-end
// @icon         https://www.etsy.com/images/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==

/* jshint esversion: 6 */
(function(){
    'use strict';

    var itemId = document.getElementById("listing-image").getAttribute("data-palette-listing-id");

    if(itemId) {
        history.replaceState(null, 'Shortened Etsy URL', "https://www.etsy.com/listing/" + itemId);
    }

})();

Greetings, Graphen

§
Posted: 2018-12-06

Hi!

Thanks a lot for giving it a try. I really appreciate it a lot because those long eBay url are very annoying.

Unfortunately it does nothing.
Tested with eBay.com without luck, the link remains the same.

Could you please test and try to fix it?

And if it works please kindly add support for :

www.befr.ebay.be www.benl.ebay.be www.eBay.fr

Thanks!

Best,

Freshhh

§
Posted: 2018-12-06

Bummer... Same for Etsy, it does nothing… weird I wonder how it can works for you and not for me?

GraphenAuthor
§
Posted: 2018-12-07

I don't know. Works perfectly for me. Firefox 63.0.3, latest Tampermonkey, Windows 10.

Modified ebay to support the three domains you mentioned.

§
Posted: 2018-12-07
Edited: 2018-12-07

Fantastic, the new eBay short URL universal script works wonders! Thank you so much, this will definitely be a lifesaving script for all users.

Just in case you don't mind adding all domains here is a full list: http://blog.linnworks.com/international-ebay-sites-list


About the ETSY script there is a little bug, currently shortened URL are transformed like this:

https://www.etsy.com/123456789/

but it must be formatted like this:

https://www.etsy.com/listing/123456789/

otherwise if you refresh the page there is a 404 not found error!

GraphenAuthor
§
Posted: 2018-12-07

Thanks for the hints, both fixed. I put both scripts online now.

Etsy: https://greasyfork.org/scripts/375272 Ebay: https://greasyfork.org/scripts/375273

§
Posted: 2018-12-07

Tested and adopted. B)
BIG THANKS ! !

Post reply

Sign in to post a reply.