diff --git a/web_scrap.py b/web_scrap.py index 0593fb5..2465d90 100644 --- a/web_scrap.py +++ b/web_scrap.py @@ -123,12 +123,12 @@ def downloadPage(webpage, backup_dir, logger): filePageWeb = path_web[len(path_web)-1] path_web.pop(len(path_web)-1) dir_page_web = "/".join(path_web) - mkdirPath("{0}/{1}".format(backup_dir, dir_page_web), logger) + mkdirPath("{0}/{1}/{2}".format(backup_dir, o.netloc, dir_page_web), logger) r = requests.get(webpage[i]) if r.status_code == 200: - fileDownload = "{0}/index.html".format(backup_dir) + fileDownload = "{0}/{1}/index.html".format(backup_dir, o.netloc) if len(dir_page_web) > 0 and len(filePageWeb) > 0: - fileDownload = "{0}{1}/{2}".format(backup_dir, dir_page_web, filePageWeb) + fileDownload = "{0}/{1}{2}/{3}".format(backup_dir, o.netloc, dir_page_web, filePageWeb) logger.info("{0}/{1} : {2}".format(i+1, len(webpage), fileDownload)) open(fileDownload, "wb").write(r.content)