Sync/dashboard, sanitize content, update config
Add local Claude permissions file; make background.js call syncToDashboard() after each run when config.syncToDashboard is enabled; improve content extraction in content.js by cloning link nodes, removing svg/style elements and stripping review-related text/counts before trimming; update config.py defaults to enable target and gamestop (remove bestbuy), set HEADLESS=True and STEALTH_HEADLESS=True to favor headless environments.
This commit is contained in:
@@ -268,6 +268,11 @@ async function runStockCheck() {
|
||||
}
|
||||
|
||||
await saveProducts();
|
||||
|
||||
// Sync to dashboard after every run
|
||||
if (config.syncToDashboard) {
|
||||
await syncToDashboard();
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch and parse products from a URL using content script
|
||||
|
||||
@@ -60,7 +60,9 @@
|
||||
let isSoldOut = false;
|
||||
|
||||
for (const link of links) {
|
||||
const text = link.textContent.trim();
|
||||
const clone = link.cloneNode(true);
|
||||
clone.querySelectorAll('svg, style').forEach(el => el.remove());
|
||||
const text = clone.textContent.trim();
|
||||
|
||||
// Check if any link says "SOLD OUT"
|
||||
if (text.toUpperCase().includes("SOLD OUT")) {
|
||||
@@ -82,6 +84,8 @@
|
||||
bestName = bestName.replace(/\$[\d,.]+/g, "").trim();
|
||||
// Remove "Add to Cart" etc
|
||||
bestName = bestName.replace(/Add to Cart/gi, "").trim();
|
||||
// Remove review star CSS/SVG junk and plain review counts
|
||||
bestName = bestName.replace(/\s*(review-|\d*\s*reviews?).*$/i, "").trim();
|
||||
// Clean whitespace
|
||||
bestName = bestName.replace(/\s+/g, " ").trim();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user