diff --git a/django_code/dashboard/templates/fapello_form.html b/django_code/dashboard/templates/fapello_form.html new file mode 100644 index 0000000..796b16e --- /dev/null +++ b/django_code/dashboard/templates/fapello_form.html @@ -0,0 +1,299 @@ + + + + + + Stash form + + + + + + + +
+
+
+
+

fapello Form

+

Download form

+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+ diff --git a/django_code/django_code/urls.py b/django_code/django_code/urls.py index dea389e..130977b 100644 --- a/django_code/django_code/urls.py +++ b/django_code/django_code/urls.py @@ -61,7 +61,9 @@ urlpatterns = [ ################## kubernetes_connection##### path('stash/hello/', stashapp.hello), path('stash/form/', stashapp.form), + path('stash/fapello/', stashapp.fapello), path('stash/submit-form/', stashapp.handle_survey_form, name='submit_form'), + path('stash/fapello-form/', stashapp.fapello_form, name='submit_form'), # path('bookstack/', docker_connection.apps.hello), diff --git a/django_code/stash_management/apps.py b/django_code/stash_management/apps.py index 28333d1..d811b69 100644 --- a/django_code/stash_management/apps.py +++ b/django_code/stash_management/apps.py @@ -2,7 +2,7 @@ from django.apps import AppConfig from django.http import HttpResponse from django.shortcuts import render from django.shortcuts import redirect -from jinja2 import Environment, FileSystemLoader +#from jinja2 import Environment, FileSystemLoader from django.core.files import File from kubernetes import client, config @@ -18,6 +18,35 @@ def hello(request): def form(request): return render(request, 'stash_form.html',{}) +def fapello(request): + return render(request, 'fapello_form.html',{}) +def fapello_form(request): + stash_folder = "/tmp/stash" + name = request.GET.get('name') + url = request.GET.get('url') + url_suffix = request.GET.get('url_suffix') + maximum_increment = int(request.GET.get('maximum_increment')) + minimum_increment = request.GET.get('minimum_increment') + #return HttpResponse(minimum_increment, content_type="text/plain") + if minimum_increment == None: + minimum_increment = 1 + + text_generated = "" + + for increment in range(minimum_increment,maximum_increment): + if len(str(increment)) == 3: + increment_generated ='0' + str(increment) + elif len(str(increment)) == 2: + increment_generated ='00' + str(increment) + elif len(str(increment)) == 1: + increment_generated ='000' + str(increment) + + + urllib.request.urlretrieve(url+increment_generated+url_suffix, stash_folder+"/"+increment_generated+url_suffix) + text_generated = "\n downloading for "+name+" "+url+increment_generated+url_suffix + return HttpResponse(text_generated, content_type="text/plain") + + def handle_survey_form(request): config.load_kube_config(config_file='/kubeconfig/config') v1 = client.BatchV1Api() diff --git a/download.sh b/download.sh new file mode 100644 index 0000000..487f90b --- /dev/null +++ b/download.sh @@ -0,0 +1,83 @@ +#!/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/?q=shy+imp" +#pornstars="shy-imp" + +#BASE_URL="https://www.pornpics.com/pornstars/gloria-sol/" +#pornstars="gloria-sol" + + +#BASE_URL="https://www.pornpics.com/pornstars/becky-summer" +#pornstars="becky-summer" + + +#clear files beforehand + +echo "Pornstar: "$pornstars +echo "URL: "$BASE_URL + +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 + echo $external_gallery > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt +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/1280" >> $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 +exit 0