updatedversion

master
flem 1 year ago
parent 2eceb7f093
commit 7eae4c2aa6

@ -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"""<div class="image"><img src="{image}"></div>"""

Loading…
Cancel
Save