I'm crawling a website and saving selected pages for offline browsing. Of course the links between pages are broken so I'd like to do something about that. Is there a somewhat simple way in python to relativize url paths like this without reinventing the wheel:
/folder1/folder2/somepage.html becomes----> folder2/somepage.html
/folder1/otherpage.html becomes----> ../otherpage.html
I understand the function would need two url paths to determine the relative path as the linked resource's path is relative to the page it appears on.