Closed zkvvoob closed 3 years ago
Please commit your attempt to a git branch, and then I can have a look at it and debug it.
EDIT: I got caught by the challenge, I am trying it now myself...
see the link to my commit above. that works for me:
python3 exportMediaWiki2Html.py https://wiki.hostsharing.net 22
I get all the pages related to this category: https://wiki.hostsharing.net/index.php?title=Kategorie:Einstieg_bei_Hostsharing
Perhaps this line caused your problems:
if (pageOnly > -1) and (page['pageid'] != pageOnly):
now that the pageOnly was your category id.
That's brilliant, @tpokorra! I just tested your amended script on my wiki and it downloaded all pages from the category I passed on to it.
Thank you so much!
Hello,
Thank you for developing this script! How difficult would it be to make it accept either a list of page ids or a category name?
EDIT: I've been playing around with a local copy of your script. If I understand it correctly, the URL should look something like that:
/api.php?action=query&list=categorymembers&format=json&cmpageid=474
So, I've tried to tweak the code to this:
url_allpages = url + "/api.php?action=query&list=categorymembers&format=json&cmpageid=" + str(pageOnly)
using the pageOnly parameter to pass a category id. And thenfor page in data['query']['categorymembers']:
However, it doesn't seem to work - no errors are returned, but also no html files are downloaded, even though the api query returns 10.