Hey,
This API call works when I do it in Python using requests:
requests.get("https://en.wikipedia.org/w/api.php", params={"action":"parse","page":"Aphrodisiac","prop":"wikitext","format":"json"})
but when I do it with wget or curl like this:
wget https://en.wikipedia.org/w/api.php?action=parse&page=Aphrodisiac&pro...
it doesn’t return pure JSON, it returns some kind of HTML and I don’t think I even see the desired data inside.
But that URL works in the browser.
Why would it have this behavior? How do curl/wget differ from a browser calling this string?
Thank you, Julius
Make sure you're quoting the URL for the shell command:
wget "https://en.wikipedia.org/w/api.php?action=parse&page=Aphrodisiac&pro..."
Otherwise characters such as '&' may be interpreted by the shell, causing you to query the wrong URL.
If the page title contains quotes or other special characters, you will also need to escape them, in a way that depends on your shell.
If you can, do this work from Python, it's a lot less error-prone.
mediawiki-api@lists.wikimedia.org