I'm new to working with html pages on python. 
I'm trying to run the BBC site offline from my PC, and I wrote a python code for that.
I've already made functions that download all html pages on the site, by going through the links found on homepage (with regex).
I have all links on a local directory, but they are all called sub0,sub1,sub2.
How can I edit the homepage so it would direct all links to the html pages on my directory instead of the pages online?
again, the pages aren't called in their original name-
so replacing the domain with a local directory won't work.
I need a way to go through all links on main page and change their whole path.
I think the best way to do this would be to create some sort of mapping file. The file would map the original URL on the BBC site => the path to the file on your machine. You could generate this file very easily during the process when you are scraping the links from the homepage. Then, when you want to crawl this site offline you can simply iterate over this document and visit the local file paths. Alternatively you could crawl over the original homepage and do a search for the links in the mapping file and find out what file they lead to.
There are some clear downsides to this approach, the most obvious being that changing the directory structure/filenames of the downloaded pages will break your crawl...
Trying to download html pages to create a very simple web crawler