Compare commits
8
Commits
1c8391d87e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ceb6ed181f | ||
|
|
5be4a4dcf2 | ||
|
|
94d3c48e38 | ||
|
|
a61a753e0d | ||
|
|
f0a5fe75b3 | ||
|
|
31635d1f01 | ||
|
|
3bc98d2b2c | ||
|
|
cc2f43c945 |
+75
@@ -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
@@ -1,65 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if username is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <reddit_username> <destination_folder>"
|
||||
exit 1
|
||||
fi
|
||||
apk add curl wget
|
||||
|
||||
USER="$1"
|
||||
DEST_FOLDER="${2:-./${USER}_images}"
|
||||
USER_AGENT="Mozilla/5.0 (compatible; RedditImageDownloader/1.0)"
|
||||
#dowload from https://www.pornpics.com/pornstars/eiby-shine/
|
||||
DESTINATION_FOLDER="/data"
|
||||
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
|
||||
# Build URL with pagination
|
||||
if [ -z "$AFTER" ]; then
|
||||
URL="${BASE_URL}?limit=100"
|
||||
else
|
||||
URL="${BASE_URL}?limit=100&after=${AFTER}"
|
||||
fi
|
||||
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
|
||||
|
||||
# Fetch posts
|
||||
RESPONSE=$(curl -s -A "$USER_AGENT" "$URL")
|
||||
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
|
||||
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
|
||||
IMAGE_URLS=$(echo "$RESPONSE" | jq -r '.data.children[] | select(.data.url | test("\\.(jpg|jpeg|png|gif)$")) | .data.url')
|
||||
|
||||
# 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
|
||||
for g in $(cat $DESTINATION_FOLDER/$pornstars-image_to_download.txt ); do
|
||||
wget -e use_proxy=yes -e http_proxy=$PROXY_HTTP $g -P $DESTINATION_FOLDER/$pornstars
|
||||
echo $g
|
||||
done
|
||||
|
||||
echo "Download complete. Images saved to $DEST_FOLDER"
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user