mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-29 20:05:51 +02:00
Add more Bipa categories and first mapping
This commit is contained in:
parent
05e03535a0
commit
410f630721
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,7 @@ exports.getBipaCategoryPages = async () => {
|
||||||
|
|
||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
let pages = res.data.replace(/[\s]*/gm, "").match(/<url>(.*?)<\/url>/gm);
|
let pages = res.data.replace(/[\s]*/gm, "").match(/<url>(.*?)<\/url>/gm);
|
||||||
pages = pages.filter((page) => /<changefreq>daily<\/changefreq>/g.test(page)); // only return pages which change daily ("monthly" are mainly seo, brand or offer pages)
|
pages = pages.filter((page) => /<changefreq>(daily|weekly)<\/changefreq>/g.test(page)); // only return pages which change daily or weekly ("monthly" are mainly seo, brand or offer pages)
|
||||||
pages = pages.map((page) => page.match(/<loc>(.*)<\/loc>/gm)[0]);
|
pages = pages.map((page) => page.match(/<loc>(.*)<\/loc>/gm)[0]);
|
||||||
pages = pages.map((page) => page.replace(/<\/{0,1}loc>/g, "")); // remove <loc> xml-tags
|
pages = pages.map((page) => page.replace(/<\/{0,1}loc>/g, "")); // remove <loc> xml-tags
|
||||||
pages = pages.filter((page) => /\/c\/.*\/.{1,}/g.test(page)); // only return 2nd level category pages (level 1 is mostly landing pages or some special offer pages)
|
pages = pages.filter((page) => /\/c\/.*\/.{1,}/g.test(page)); // only return 2nd level category pages (level 1 is mostly landing pages or some special offer pages)
|
||||||
|
@ -118,6 +118,9 @@ exports.initializeCategoryMapping = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort alphabetically for easier category mapping
|
||||||
|
categories.sort((a, b) => a.id.localeCompare(b.id));
|
||||||
|
|
||||||
utils.mergeAndSaveCategories("bipa", categories);
|
utils.mergeAndSaveCategories("bipa", categories);
|
||||||
exports.categoryLookup = {};
|
exports.categoryLookup = {};
|
||||||
for (const category of categories) {
|
for (const category of categories) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user