How to sort extension in the Chrome Web Store?

Posted on

Problem :

The Google Chrome Web Store seems like a disaster to me. I cannot make sense of it.

How can you sort extensions by popularity? By rating? By amount of downloads? By newest? By recently updated?

Am I completely overlooking something?

https://chrome.google.com/webstore/category/extensions

Solution :

I have created a simple sorter js which works on Chrome Dev tools console. You can reach the GitHub page here.

It mainly sorts the extensions on the Chrome Web Store. It runs on Chrome Dev Tools console which is started by Ctrl+Shift+I.

After opening the search extensions page on the link https://chrome.google.com/webstore/search/PHRASE?_category=extensions with your search phrase replaced by PHRASE. And than the code under sorter.js is run on the chrome dev cosole.

It firstly loads all the extensions on the infinitly-scroll page by automatically scroll the page until not scroll. Then it sorts them by number of votes.

var i = 0;
var num_of_items = 0;
var stop = false;
function startCheck(max)
{
    i++;
    
    //document.querySelectorAll('div.h-a-Kd.a-Hd-mb')[0];
    var bottom = document.querySelectorAll('div.h-a-Hd-mb.a-Hd-mb')[0];
    bottom.scrollIntoView();
    //scrollTo(scrollX,scrollY+1000); 
    console.log(i.toString());  
    
    var items = document.querySelectorAll('.a-d-na.a-d.webstore-test-wall-tile.a-d-zc.Xd.dd');
    var new_num_of_items = items.length;
    if (num_of_items != new_num_of_items)
    {
        num_of_items = new_num_of_items;
        console.log('Loaded items : ' + new_num_of_items);
    }   
    
    if (i>max || stop) 
    {
        i = 0;
        num_of_items = 0;
        stop = false;
        items[new_num_of_items-1].scrollIntoView(false);
        sortsort();
        return;
    }
    
    var t = setTimeout(function (){startCheck(max);}, 100);
}

var MAX_COUNT = 25;
var counter = 0;
function stopCheck()
{   
    var spin = document.querySelectorAll('div.h-a-Kd.a-Hd-mb')[0];  
    var state_new = spin.attributes.style.value == "display: none;"
    
    if (state_new)
        counter++;
    else
        counter=0;
    
    console.log('Counter : ' + counter);
    if (counter > MAX_COUNT)
    {
        counter = 0;
        stop = true;        
        return;
    }
    
    var t = setTimeout(function (){stopCheck();}, 100);
}

var sortsort = function() {

    var ab = document.querySelectorAll('.a-d-na.a-d.webstore-test-wall-tile.a-d-zc.Xd.dd');
    console.log(ab.length);
    var ab_arry = Array.from(ab);

    var index_str;
    var star_str;
    ab_arry.forEach((star) => {
        
        index_str = star.attributes.hasOwnProperty("index") ? Number(star.attributes.index.value.toString().replace(/,/g, '')) : 0
        star_str  = star.getElementsByClassName("nAtiRe").length > 0 ? Number(star.getElementsByClassName("nAtiRe")[0].textContent.toString().replace(/,/g, '')).toString() : "Not voted";

        console.log( index_str + " = >>>> " + star_str);        
    });

    ab_arry.sort(function (a,b) {
        var a_star =  a.getElementsByClassName("nAtiRe").length > 0 ? Number(a.getElementsByClassName("nAtiRe")[0].textContent.toString().replace(/,/g, '')) : 0;
        var b_star =  b.getElementsByClassName("nAtiRe").length > 0 ? Number(b.getElementsByClassName("nAtiRe")[0].textContent.toString().replace(/,/g, '')) : 0;
        
        return (b_star - a_star);   
    });


    let row_nodes = document.querySelectorAll('.h-a-x > [role="grid"] > [role="row"]');
    var row_nodes_arry = Array.from(row_nodes);
    var sr;

    for (var rr = 0; rr < row_nodes_arry.length; rr++)
    {   
        sr_start = rr * 3;
        
        var msg = rr.toString() + ' <--- ';
        for (var sr = sr_start; sr < sr_start + 3 && sr < ab_arry.length ; sr++)
        {
            msg += '1:' + sr + ' ';
            row_nodes_arry[rr].appendChild(ab_arry[sr]);
        }   
        console.log(msg);
    }

}

startCheck(3000);
stopCheck();

There isn’t much to do, but here’s the little things that you can do:

  • By rating (1):
    • You can filter by the rating – set the low limit of starts for your results.
  • By recently updated (2):
    • Recently updated as stated by Google, we can’t know if there’s more behind it. I guess (from what I see), that’s actually “recently updated popular extensions”.
  • Popularity (3):
    • I think the closest would be the Editor’s Picks section. Those are usually good and popular apps/extensions, and the fact that they’re being picked also boosts them.
  • Newest:
    • Unfortunately it doesn’t seem to be possible. Maybe if there’s a feed of updates from the Web Store you can get this information from there.
  • Downloads:
    • Not really an option, though I think it can be known (more or less) by the other parameters (rating, featured, editor’s picks etc.)

enter image description here

I found a way to sort extensions by ‘recently updated’ in a slightly roundabout way by using Google:

For example, I was looking for recent jQuery addons:

  • go to www.google.com, search for…
    site:chrome.google.com “jquery”‘ (or you could also use ‘intitle:”jquery”‘)
  • click on ‘Tools > Anytime‘, change it to ‘Past week‘ or whatever timeframe you want

the results will include both recently added and updated addons

Leave a Reply

Your email address will not be published. Required fields are marked *