felixfischer / sort-amazon-results-by-review-count

Userscript for sorting Amazon search results by number of reviews
GNU General Public License v3.0
12 stars 4 forks source link

Amazon website revision #2

Open haarp opened 5 years ago

haarp commented 5 years ago

Hello,

it seems Amazon has changed their site slightly.

While this script still works on categories, such as https://www.amazon.de/s?k=&rh=n%3A2077447031

But it will not work anymore if a search term or filter is active, such as https://www.amazon.de/s?k=proxxon&rh=n%3A2077447031

skupjoe commented 5 years ago

Correct. No longer working. Please update- I love this script!

skupjoe commented 4 years ago

I miss this beautiful script for shopping!

YJEGEN commented 4 years ago

This is a great script. Can you update your script? It is currently unavailable.

YJEGEN commented 4 years ago

我想念这个漂亮的购物脚本!

I miss this beautiful script for shopping!

The author may not update again. Do you know that there are other similar products?

YJEGEN commented 4 years ago

Hello,

it seems Amazon has changed their site slightly.

While this script still works on categories, such as https://www.amazon.de/s?k=&rh=n%3A2077447031

But it will not work anymore if a search term or filter is active, such as https://www.amazon.de/s?k=proxxon&rh=n%3A2077447031

The author may not update again. Do you know that there are other similar products?

toothytoad commented 3 years ago

I'm sure someone can write something more succinct, but this works for me.

(function() {

    function getDataUrl() {
        let qSelector = document.querySelector('#s-result-sort-select');
        let featuredrankDataUrl = qSelector.options[1].getAttribute('data-url');
        return featuredrankDataUrl.replace(/price-asc-rank/gi,"review-count-rank");
    }

    function addOption() {
        let sortDropdown = document.getElementById('s-result-sort-select');
        let hasOption = document.getElementById('sort-rcr');
        for(const opt in sortDropdown){
            if(sortDropdown.options[opt].value == "review-count-rank"){
                hasOption = true;
                break;
            }
        }
        if (sortDropdown && !hasOption) {
            let newOption = `<option data-url="${getDataUrl()}" value="review-count-rank" id="sort-rcr">Most reviews</option>`;
            sortDropdown.insertAdjacentHTML('beforeend', newOption);
        }
    }

    setInterval(addOption, 1000);

})();