#!/usr/bin/env python3 from base64 import b64encode from bs4 import BeautifulSoup from re import sub from sys import argv File = argv[-1] B64Prefix = 'data:text/html;base64,' def b64encodeStr(Data): return b64encode(Data.encode()).decode() def MkHtml(Content:str): return f'''\ {Content} ''' def Fix1(m): return f'
{m.group(2)}' def SafeIframe(m): SrcData = m.group(2) SrcData = b64encodeStr(MkHtml(f'Click to load: {SrcData}')) return f'' Html = str(BeautifulSoup(open(File, 'r'), 'html5lib')) Html = sub('
(.+)<\/summary>\s*<\/a>', Fix1, Html) Html = sub('<\/iframe>', SafeIframe, Html) Html = sub('