From 789fc8bcbc82d3353afaa66a29adbc7d3585aacd Mon Sep 17 00:00:00 2001 From: pierre geeraert Date: Tue, 2 Dec 2025 22:41:52 +0000 Subject: [PATCH] we are now able locally to get all albums and go through all of them and get the images links --- django_code/stash_management/apps.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/django_code/stash_management/apps.py b/django_code/stash_management/apps.py index 1ac167c..4f40b81 100644 --- a/django_code/stash_management/apps.py +++ b/django_code/stash_management/apps.py @@ -16,7 +16,6 @@ import mimetypes import ruamel.yaml import yaml from urllib import request as urlrequest -from urllib import parse as urlparse proxy_url = 'http://gluetun-svc.gluetun.svc:8888' proxy = urlrequest.ProxyHandler({ @@ -49,10 +48,24 @@ def album_downloader(name,url,external_galleries): urlcurl = urlrequest.urlopen(req).read() page = requests.get(url) webpage = html.fromstring(page.content) + + #get all URLs from the code source (searching for href tag on the code) + #https://stackoverflow.com/questions/21455349/xpath-query-get-attribute-href-from-a-tag + + webpage_all_url = webpage.xpath('//a/@href') + + #search for the href that contains the galleries + webpage_all_album_url = webpage.xpath("//a[contains(@href,'pornpics.com/galleries/')]/@href") + #print(webpage_all_album_url[3]) + #print(webpage_all_album_url) - print(webpage.xpath('//a/@href')) - #grep "https://www.pornpics.com/galleries/" - + + for album in webpage_all_album_url: + print("Album "+album) + print("") + page = requests.get(album) + webpage = html.fromstring(page.content) + print(webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href")) return 0