From 7eae4c2aa61f38ab634c7228ed936193c7a7f561 Mon Sep 17 00:00:00 2001 From: flem Date: Mon, 1 May 2023 12:00:17 +0200 Subject: [PATCH] updatedversion --- scripttryout2.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripttryout2.py b/scripttryout2.py index 17dbb01..979d463 100644 --- a/scripttryout2.py +++ b/scripttryout2.py @@ -3,6 +3,7 @@ import json import requests import mwclient import os +import urllib.parse data=request.urlopen('https://pzwiki.wdka.nl/mw-mediadesign/api.php?action=parse&page=User:FLEM/Notebook&format=json').read() print(data) @@ -24,8 +25,8 @@ print(text) for image in images: - here we download images - S = requests.Session() + #here we download images + S = requests.Session() URL = "https://pzwiki.wdka.nl/mw-mediadesign/api.php" #this is wrong, it gives me the images of all the media design instead of just one page @@ -46,7 +47,7 @@ for image in images: for image in IMAGES: imageurl = image["url"] - filename = image["title"].replace('File:', '') + filename = image["title"].replace('File:', '').replace(' ', '_') print(imageurl) print(filename) @@ -61,6 +62,7 @@ html=text.split("\n") new_html="" for line in html: for image in images: + image=urllib.parse.quote_plus(image) #replace html img element if image in line: new=f"""
"""