From 79836753258a853413d2753c586883e8151f0f0f Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 24 May 2022 00:10:38 +0200 Subject: [PATCH] Visual Selector - be more resilient when sites interfere with the xPath scraping --- changedetectionio/content_fetcher.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/changedetectionio/content_fetcher.py b/changedetectionio/content_fetcher.py index 5ac95927..2ac7b636 100644 --- a/changedetectionio/content_fetcher.py +++ b/changedetectionio/content_fetcher.py @@ -89,14 +89,22 @@ class Fetcher(): xpath_result =d; } } catch (e) { - var x=1; + console.log(e); } -// You could swap it and default to getXpath and then try the smarter one + // You could swap it and default to getXpath and then try the smarter one // default back to the less intelligent one if (!xpath_result) { - xpath_result = getXPath(elements[i]); + try { + // I've seen on FB and eBay that this doesnt work + // ReferenceError: getXPath is not defined at eval (eval at evaluate (:152:29), :67:20) at UtilityScript.evaluate (:159:18) at UtilityScript. (:1:44) + xpath_result = getXPath(elements[i]); + } catch (e) { + console.log(e); + continue; + } } + if(window.getComputedStyle(elements[i]).visibility === "hidden") { continue; }