

def archive(url):
    'Return HTML text for given URL. Simple wrapper for gethtml function.'

    def replacepat(pat, replacement, string):
        import re
        cpat = re.compile(pat, (re.S | re.I))
        return cpat.sub(replacement, string)
    import base64, bz2
    somehtml = gethtml(url)
    if (not somehtml):
        return None
    globs.html = somehtml
    import re
    badpats = ['id="__EVENTVALIDATION" value=".*?"', 'id="__VIEWSTATE" value=".*?"']
    for pat in badpats:
        somehtml = replacepat(pat, '', somehtml)
    utf8html = somehtml.encode('utf-8-sig')
    compressed = bz2.compress(utf8html)
    cellfriendly = base64.b64encode(compressed)
    maxl = 900000
    alen = len(cellfriendly)
    if (alen > maxl):
        return ('[HTML too big to archivei (%s > %s)]' % (alen, maxl))
    return cellfriendly
    whatisthatmess = {
        'url': url,
        'base64.decode(bz2.decompress(this))': cellfriendly,
    }
    return json.dumps(whatisthatmess)

dataset/ETHPy150Open miklevin/pipulate/common.py archive/original