You don’t need fancy things, just see the string methods in the standard library and you can easily split your url between ‘filename’ part and the rest:
url.rsplit("https://stackoverflow.com/", 1)
So you can get the part you’re interested in simply with:
url.rsplit("https://stackoverflow.com/", 1)[-1]