diff --git a/getify.py b/getify.py index be3f614..05f6519 100644 --- a/getify.py +++ b/getify.py @@ -11,6 +11,7 @@ from bs4 import BeautifulSoup import uuid import html +import traceback def find_between(file): f = open(file, "r", encoding = "utf8") @@ -49,14 +50,15 @@ def clean(file_name_in, file_name_out, start): imgext = tb[len(tb) - 1] imgname = file_name_out + '_im{}'.format(cpt)+'.'+imgext tb = imgname.split('/') - imgname2 = tb[len(tb) - 1] + imgname2 = imgname.replace(tb[len(tb) - 1], 'images/'+tb[len(tb) - 1]) print(img['src']) try: - download(img['src'], imgname) - img['src'] = 'images/'+imgname2 - suplementList.append(imgname2) + + download(img['src'], imgname2) + img['src'] = 'images/'+tb[len(tb) - 1] + suplementList.append('images/'+tb[len(tb) - 1]) except: - {} + traceback.print_exc() cpt += 1 soup = block break @@ -71,8 +73,10 @@ def clean(file_name_in, file_name_out, start): file.write("\n"+'') file.write("\n") file.write("\n
") + file.write("\n