epicyon/scripts/update_ai_cwlist

31 lines
877 B
Bash
Executable File

#!/bin/bash
wget https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/refs/heads/main/noai_hosts.txt
if [ ! -f noai_hosts.txt ]; then
exit 0
fi
TEMPFILENAME=noai_hosts.txt.tmp
CW_FILENAME=cwlists/ai_generated.json
grep "0.0.0.0" noai_hosts.txt | awk -F ' ' '{print $2}' > $TEMPFILENAME
{ echo "{";
echo " \"name\": \"AI Generated Content\",";
echo " \"warning\": \"AI Generated Content\",";
echo " \"description\": \"Typically images generated by 'AI' generative models\",";
echo " \"words\": [],";
echo " \"hashtags\": [],";
echo " \"domains\": ["; } > $CW_FILENAME
while IFS= read -r line
do
linestr=$(echo "$line" | sed 's/\r$//')
linestr2=" \"${linestr}\","
echo "$linestr2" >> $CW_FILENAME
done < $TEMPFILENAME
{ echo " ]";
echo "}"; } >> $CW_FILENAME
rm $TEMPFILENAME
rm noai_hosts.txt