index fix

This commit is contained in:
itec78 2023-03-27 22:43:36 +02:00
parent 5c8fadf233
commit 3929dcdebf

View file

@ -10,6 +10,7 @@ import html2text
import pdfkit
import locale
import PyPDF2
import html
locale.setlocale(locale.LC_TIME, 'it_IT.UTF-8')
@ -161,9 +162,15 @@ def main():
for vgo in all_vgos:
vgo_num = html2text.html2text(vgo['content']).split(' ')[0]
vgo_name = os.linesep.join([s for s in html2text.html2text(vgo['content']).splitlines() if s]).splitlines()[-1]
if len(vgo_name) < 10:
vgo_name = [s for s in html2text.html2text(vgo['content']).split("\n\n") if s][-1].replace("\n"," ")
# vgo_name = os.linesep.join([s for s in html2text.html2text(vgo['content']).splitlines() if s]).splitlines()[-1]
# if len(vgo_name) < 10:
# vgo_name = [s for s in html2text.html2text(vgo['content']).split("\n\n") if s][-1].replace("\n"," ")
vgo_name = vgo['content'].split("<p>")[-1].replace("</p>","")
vgo_name = vgo_name.split("<br />")[-1]
vgo_name = vgo_name.split("</a>")[-1]
vgo_name = html.unescape(vgo_name).strip()
#print(vgo_num +' - '+ vgo_name)
#print(str(vgo['id']) +' '+ vgo['uri'])
vgo_dict[vgo_num] = vgo_name