add proxy for the first part and try to develop the second part

This commit is contained in:
Pierre Geeraert
2025-12-03 12:08:56 +00:00
parent 6c34d510e5
commit 460f18d85a
1095 changed files with 358799 additions and 5 deletions
+25 -2
View File
@@ -16,6 +16,10 @@ import mimetypes
import ruamel.yaml
import yaml
from urllib import request as urlrequest
import urlparse
proxy_url = 'http://gluetun-svc.gluetun.svc:8888'
proxy = urlrequest.ProxyHandler({
@@ -44,6 +48,10 @@ def album_form(request):
def album_downloader(name,url,external_galleries):
print(name+" "+url+" "+external_galleries)
opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener)
req = urlrequest.Request(url)
urlcurl = urlrequest.urlopen(req).read()
page = requests.get(url)
@@ -65,10 +73,25 @@ def album_downloader(name,url,external_galleries):
print("")
page = requests.get(album)
webpage = html.fromstring(page.content)
print(webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href"))
images_list = webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href")
images_downloader(name=name,images_url_list=images_list)
print(images_list)
return 0
def images_downloader(name,images_url_list);
for imnage_url in images_url_list:
split = urlparse.urlsplit(url)
filename = destination_folder + split.path.split("/")[-1]
print("downloading: "+filename)
opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener)
urlrequest.urlretrieve(url, filename )
return 0
def incremental(request):
return render(request, 'incremental_form.html',{})