Compare commits

..
8 Commits
Author SHA1 Message Date
pi-ux-ce ceb6ed181f add template file 2025-07-28 11:42:06 +00:00
pi-ux-ce 5be4a4dcf2 check if we need http proxy or not 2025-05-15 19:12:58 +00:00
pi-ux-ce 94d3c48e38 add the option to exclude first search 2025-05-15 19:10:33 +00:00
pi-ux-ce a61a753e0d Update download.sh 2025-05-15 19:06:55 +00:00
pi-ux-ce f0a5fe75b3 Update reddit_downloader.sh 2025-05-08 22:50:03 +00:00
pi-ux-ce 31635d1f01 Update reddit_downloader.sh 2025-05-08 22:30:12 +00:00
pi-ux-ce 3bc98d2b2c update destination path 2025-05-08 22:12:42 +00:00
pi-ux-ce cc2f43c945 usefull to dowload from pornpics.com 2025-05-08 21:51:52 +00:00
3 changed files with 132 additions and 53 deletions
+75
View File
@@ -0,0 +1,75 @@
#!/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
#check if we will use a HTTP proxy or not
if [[ -z $http_proxy ]]; then
echo "not using proxy"
curl_command="curl"
else
echo "using proxy"
curl_command="curl -x $http_proxy"
fi
#dowload from https://www.pornpics.com/pornstars/eiby-shine/
DESTINATION_FOLDER="/data"
PROXY_HTTP="http://gluetun-svc.gluetun.svc:8888"
#BASE_URL="https://www.pornpics.com/pornstars/eiby-shine/"
#pornstars="eiby-shine"
BASE_URL="https://www.pornpics.com/pornstars/chloe-camilla/"
pornstars="chloe-camilla"
#BASE_URL="https://www.pornpics.com/pornstars/becky-summer"
#pornstars="becky-summer"
#clear files beforehand
mkdir -p $DESTINATION_FOLDER/$pornstars
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_command -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_command $f | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://cdni.pornpics.com/" >> $DESTINATION_FOLDER/$pornstars-image_to_download.txt
echo $f
done
for g in $(cat $DESTINATION_FOLDER/$pornstars-image_to_download.txt ); do
$curl_command -O --output-dir $DESTINATION_FOLDER/$pornstars $g
# wget -e use_proxy=yes -e http_proxy=$PROXY_HTTP $g -P $DESTINATION_FOLDER/$pornstars
echo $g
done
+20 -53
View File
@@ -1,65 +1,32 @@
#!/bin/bash #!/bin/bash
# Check if username is provided apk add curl wget
if [ -z "$1" ]; then
echo "Usage: $0 <reddit_username> <destination_folder>"
exit 1
fi
USER="$1" #dowload from https://www.pornpics.com/pornstars/eiby-shine/
DEST_FOLDER="${2:-./${USER}_images}" DESTINATION_FOLDER="/data"
USER_AGENT="Mozilla/5.0 (compatible; RedditImageDownloader/1.0)" BASE_URL="https://www.pornpics.com/pornstars/eiby-shine/"
pornstars="eiby-shine"
PROXY_HTTP="http://stashgluetun-svc:8888"
mkdir -p "$DEST_FOLDER" #BASE_URL="https://www.pornpics.com/pornstars/chloe-camilla/"
#pornstars="chloe-camilla"
AFTER=""
BASE_URL="https://www.reddit.com/user/$USER/submitted/.json"
echo "Fetching all image posts from user $USER..." #clear files beforehand
echo "" > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
echo "" > $DESTINATION_FOLDER/$pornstars-image_to_download.txt
while true; do mkdir -p $DESTINATION_FOLDER/$pornstars
# Build URL with pagination 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 [ -z "$AFTER" ]; then
URL="${BASE_URL}?limit=100"
else
URL="${BASE_URL}?limit=100&after=${AFTER}"
fi
# Fetch posts for f in $(cat $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt ); do
RESPONSE=$(curl -s -A "$USER_AGENT" "$URL") 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
echo $f
done
# Validate JSON
if ! echo "$RESPONSE" | jq empty 2>/dev/null; then
echo "Error: Failed to fetch or parse JSON. Exiting."
break
fi
# Extract image URLs for g in $(cat $DESTINATION_FOLDER/$pornstars-image_to_download.txt ); do
IMAGE_URLS=$(echo "$RESPONSE" | jq -r '.data.children[] | select(.data.url | test("\\.(jpg|jpeg|png|gif)$")) | .data.url') wget -e use_proxy=yes -e http_proxy=$PROXY_HTTP $g -P $DESTINATION_FOLDER/$pornstars
echo $g
# Exit if no more images found
if [ -z "$IMAGE_URLS" ]; then
echo "No more images found on this page."
fi
# Download images
echo "$IMAGE_URLS" | while read -r image_url; do
[ -z "$image_url" ] && continue
FILENAME=$(basename "$image_url")
if [ ! -f "$DEST_FOLDER/$FILENAME" ]; then
echo "Downloading $FILENAME..."
curl -s -A "$USER_AGENT" -o "$DEST_FOLDER/$FILENAME" "$image_url"
else
echo "Skipping existing file $FILENAME"
fi
done
# Get 'after' token for pagination
AFTER=$(echo "$RESPONSE" | jq -r '.data.after')
if [ "$AFTER" == "null" ] || [ -z "$AFTER" ]; then
echo "Reached end of posts."
break
fi
done done
echo "Download complete. Images saved to $DEST_FOLDER"
+37
View File
@@ -0,0 +1,37 @@
apiVersion: batch/v1
kind: Job
metadata:
name: stash-pornpics-dowloader
namespace: stash
spec:
template:
spec:
containers:
- name: stash-pornpics-dowloader
image: bash
imagePullPolicy: Always
volumeMounts:
- mountPath: /config
name: scripts
- mountPath: /data
mountPropagation: None
name: data-pvc
command:
- bash
- /config/download.sh
- --http_proxy
- "http://gluetun-svc.gluetun.svc:8888"
- --BASE_URL
- "{{ url }}"
- --pornstars
- "{{ name }}"
restartPolicy: Never
volumes:
- configMap:
defaultMode: 0744
name: pornpic-dowloader
name: scripts
- name: data-pvc
persistentVolumeClaim:
claimName: data-pvc
backoffLimit: 4