From 94d3c48e3840f545b1cda78a687810b5c63d55bf Mon Sep 17 00:00:00 2001 From: pi-ux-ce Date: Thu, 15 May 2025 19:10:33 +0000 Subject: [PATCH] add the option to exclude first search --- download.sh | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/download.sh b/download.sh index 6345e23..575dc1d 100644 --- a/download.sh +++ b/download.sh @@ -1,7 +1,22 @@ #!/bin/bash +#install required packages apk add curl wget +#named argument generation +skip_searching_gallery="${skip_searching_gallery:-false}" + + +while [ $# -gt 0 ]; do + if [[ $1 == "--"* ]]; then + v="${1/--/}" + declare "$v"="$2" + shift + fi + shift +done + + #dowload from https://www.pornpics.com/pornstars/eiby-shine/ DESTINATION_FOLDER="/data" PROXY_HTTP="http://gluetun-svc.gluetun.svc:8888" @@ -17,11 +32,24 @@ pornstars="chloe-camilla" #clear files beforehand -echo "" > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt -echo "" > $DESTINATION_FOLDER/$pornstars-image_to_download.txt + mkdir -p $DESTINATION_FOLDER/$pornstars -curl -x $PROXY_HTTP -s $BASE_URL | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://www.pornpics.com/galleries/" |sort -u >> $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt + +if [[ $skip_searching_gallery == true ]]; then + echo "not looping through galleries" + echo "using existing file instead" + #because we need to keep the file $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt with the existing URL , in this condition, + #no deletion of this file +else + echo "looping through galleries" + #because we will re-generate this file, can be emptied + echo "" > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt + curl -x $PROXY_HTTP -s $BASE_URL | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://www.pornpics.com/galleries/" |sort -u >> $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt +fi + +echo "" > $DESTINATION_FOLDER/$pornstars-image_to_download.txt + for f in $(cat $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt ); do curl -x $PROXY_HTTP $f | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://cdni.pornpics.com/" >> $DESTINATION_FOLDER/$pornstars-image_to_download.txt