1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2026-04-21 12:00:50 +02:00

Don't break trying to de-cloudflare links without an href

This commit is contained in:
David Lynch 2026-01-04 22:41:26 -06:00
parent a570580f98
commit 14e7d5bf1b

View file

@ -315,7 +315,7 @@ class Site:
# See: https://usamaejaz.com/cloudflare-email-decoding/
enc = bytes.fromhex(tag['data-cfemail'])
email = bytes([c ^ enc[0] for c in enc[1:]]).decode('utf8')
if tag.parent.name == 'a' and tag.parent['href'].startswith('/cdn-cgi/l/email-protection'):
if tag.parent.name == 'a' and 'href' in tag.parent and tag.parent['href'].startswith('/cdn-cgi/l/email-protection'):
tag = tag.parent
tag.insert_before(email)
tag.decompose()