def get_key(soup):
    '''
    On each chapter page, a <script> tag is inserted that overrides the
    encryption key, so we'll need to find that. Only fall back to default key
    if such a tag is not found.
    '''

    crypto_tag = soup.find(_crypto_tag)
    if crypto_tag is None:
        return _default_key

    pat = re.compile('\["(.+)"\]')
    keys = pat.findall(crypto_tag.text)
    if len(keys) > 0:
        unhashed_key = keys[-1].encode().decode('unicode_escape')
        return _generate_sha(unhashed_key)
    else:
        return _default_key
On each chapter page, a <script> tag is inserted that overrides the
    encryption key, so we'll need to find that. Only fall back to default key
    if such a tag is not found.