[Solved] A Random Wikipedia Article Generator


According to: https://en.wikipedia.org/wiki/Wikipedia:Special:Random

The endpoint for a categorized random subject is:
https://en.wikipedia.org/wiki/Special:RandomInCategory/

And not:
https://en.wikipedia.org/wiki/Special:Random/

So you should change your url to:

url = requests.get(f"https://en.wikipedia.org/wiki/Special:RandomInCategory/{topic}")

1

solved A Random Wikipedia Article Generator