import sys
with open('tmp_home_current.html', 'r', encoding='utf-8') as f:
html = f.read()
img_start = html.find('')
if img_start == -1:
print("Could not find image start")
sys.exit(1)
img_end_str = ''
img_end = html.find(img_end_str, img_start)
if img_end == -1:
print("Could not find image end")
sys.exit(1)
img_end += len(img_end_str)
img_block = html[img_start:img_end]
# remove it from html
html = html[:img_start] + html[img_end:]
# strip empty lines where the block was
html = '\n'.join([line for line in html.split('\n') if line.strip() != '' or '<' in line])
# modify img_block
new_img_block = img_block.replace('', '')
new_img_block = new_img_block.replace('', '')
new_img_block = new_img_block.replace('max-width:100%', 'width:275px;max-width:100%')
# Add it at the top
html = new_img_block + '\n\n' + html
# Now for the saying block
saying_marker = '
What they\'re Saying
'
saying_idx = html.find(saying_marker)
if saying_idx == -1:
print("Could not find saying marker")
sys.exit(1)
saying_start = html.rfind('