*(global): update trackers db

This commit is contained in:
Andrey Meshkov 2020-01-30 18:40:58 +03:00
parent 76be272787
commit 6faf2ce931
2 changed files with 667 additions and 641 deletions

File diff suppressed because it is too large Load Diff

View File

@ -44,16 +44,36 @@ async function runScript() {
whotracksme.categories[row.id] = row.name; whotracksme.categories[row.id] = row.name;
}); });
const companies = {};
db.each("SELECT * FROM companies", function (err, row) {
if (err) {
console.error(err);
return;
}
companies[row.id] = {
"id": row.id,
"name": row.name,
"website_url": row.website_url
};
});
db.each("SELECT * FROM trackers", function (err, row) { db.each("SELECT * FROM trackers", function (err, row) {
if (err) { if (err) {
console.error(err); console.error(err);
return; return;
} }
const company = companies[row.company_id];
let url = row.website_url;
if (!url && company) {
url = company.website_url;
}
whotracksme.trackers[row.id] = { whotracksme.trackers[row.id] = {
"name": row.name, "name": row.name,
"categoryId": row.category_id, "categoryId": row.category_id,
"url": row.website_url "url": url,
}; };
}); });