Fix error with parsing domain list

This commit is contained in:
Arkadiusz Wieczorek 2022-11-20 13:09:02 +01:00
parent c8dc0ff70d
commit 843b6efc4d
3 changed files with 15 additions and 15 deletions

View File

@ -4,15 +4,15 @@ BLOATING_DOMAINS=$(cat bloating-domains.txt)
bloat_firefox(){
if [ "$#" = 0 ]; then
echo "Bloating Firefox by bloating defined domain list..."
DOMAINS=$(printf '%s\n' "${BLOATING_DOMAINS[@]}")
DOMAINS_LIST=$(printf '%s\n' "${BLOATING_DOMAINS[@]}")
else
echo "Bloating Firefox by requested domain list..."
DOMAINS=`node filter-requested-domains.js "$1"`
DOMAINS_LIST=`node filter-requested-domains.js "$1"`
echo "selected domains"
echo $DOMAINS
echo $DOMAINS_LIST
fi
if [ -n "$DOMAINS" ]; then
if [ -n "$DOMAINS_LIST" ]; then
while IFS= read -r DOMAIN; do
# these domains return a 404 anyways, no need to waste time on them:
if is_http_error "$DOMAIN"; then echo "skipping $DOMAIN"; continue; fi
@ -26,7 +26,7 @@ bloat_firefox(){
xdotool key Return
sleep 1.5
grab "$DOMAIN after"
done <<< "$DOMAINS"
done <<< "$DOMAINS_LIST"
else
echo "No need to bloat"
fi

View File

@ -1,15 +1,15 @@
facebook.com
google.com
hotjar.com
maps.google.com
linkedin.com
cookielaw.org
googletagmanager.com
googleapis.com
www.google.com
googletagmanager.com
hotjar.com
linkedin.com
maps.google.com
sirdata.com
xandr.com
site.adform.com
www.cookiebot.com
www.google.com
xandr.com
adtonos.com/pl/home-pl
adtraction.com/pl
www.cookiebot.com
cookielaw.org

View File

@ -4,11 +4,11 @@ const BLOATING_DOMAINS = (
fs.readFileSync(pth.join(__dirname, "bloating-domains.txt")) + ""
).split("\n");
const input = process.argv[2];
const REQUESTED_DOMAINS = JSON.parse(input);
const REQUESTED_DOMAINS = input.split('\n');
const array_diff = REQUESTED_DOMAINS.filter(
(v) => !BLOATING_DOMAINS.includes(v)
);
);
for (let i in array_diff) {
console.log(array_diff[i]);