Skip plamienie for dimans that return an error upon http request

This commit is contained in:
Kuba Orlik 2022-07-14 22:19:34 +02:00
parent 6d1f3f2bf1
commit e9213004d4
3 changed files with 15 additions and 1 deletions

View File

@ -48,6 +48,7 @@ RUN apk add freetype-dev
RUN python3 -m pip install --upgrade Pillow RUN python3 -m pip install --upgrade Pillow
RUN apk add zip RUN apk add zip
RUN apk add xclip RUN apk add xclip
RUN apk add curl
COPY . /opt COPY . /opt
CMD /opt/prepare-firefox.sh CMD /opt/prepare-firefox.sh

View File

@ -14,7 +14,7 @@ DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"`
source ./utils.sh source ./utils.sh
PREVIEW="TRUE" # set to "TRUE" in order to enable automatic screenshots kept in preview.png PREVIEW="FALSE" # set to "TRUE" in order to enable automatic screenshots kept in preview.png
if [ "$PREVIEW" = "TRUE" ]; if [ "$PREVIEW" = "TRUE" ];
then then
@ -29,6 +29,8 @@ ORIGIN_DOMAIN=$(sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/' <<< "$URL")
while IFS= read -r DOMAIN; do 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
load_website "$DOMAIN?hl=pl" "$DOMAIN" load_website "$DOMAIN?hl=pl" "$DOMAIN"
open_console open_console
grab "$DOMAIN before" grab "$DOMAIN before"

View File

@ -241,3 +241,14 @@ screenshot_and_annotate(){
"Cookie" "identyfikator internetowy z cookie" 11 ""\ "Cookie" "identyfikator internetowy z cookie" 11 ""\
"Referer" "Część mojej historii przeglądania" 0 "$ORIGIN_DOMAIN" "Referer" "Część mojej historii przeglądania" 0 "$ORIGIN_DOMAIN"
} }
get_http_status(){
_url="$1"
curl -L -s -o /dev/null --head -w "%{http_code}" "$_url"
}
is_http_error(){
_url="$1"
status=$(get_http_status "$_url")
[ "${status:0:1}" = "4" ]
}