#!/usr/bin/python3 from collections import OrderedDict import ox api = ox.API('https://indiancine.ma/api/') doc = api.getDocument(id='DWA')['data']['text'] section_html = [] menu_html = [] for section in doc.split('

')[1:]: title = section[:section.index('

')] name = title.lower() html = section[section.index('')+5:] menu_html.append('{}'.format(name, title)) section_html.append('
{}\n
'.format(name, html)) section_html = '\n'.join(section_html) menu_html = '\n' menu_html += ' \n' with open('index.html') as fd: index = fd.read() head = index[:index.index('