glorfindel-SE-Userscripts/hnq-research/site-stats-extractor.js

9 lines
428 B
JavaScript
Raw Permalink Normal View History

2018-11-10 12:45:48 +00:00
// https://stackexchange.com/sites#traffic
var message = '';
$('div.lv-item').each(function() {
let href = $(this).find('a')[0].getAttribute('href');
let traffic = $(this).find('div.lv-stats-box:contains(visits/day) > span > span')[0];
let visits = parseInt(traffic.getAttribute('title').replace(/,/g, ''));
message += 'UPDATE sites SET visits = ' + visits + ' WHERE url = \'' + href + '\';\n';
});
console.log(message);