def parse_emails grab body decode_entities grab response unicode_body

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def parse_emails(grab):
body = decode_entities(grab.response.unicode_body())
emails = set()
for email in RE_EMAIL1.findall(body):
emails.add(email.replace(' ', ''))
for email in RE_EMAIL2.findall(body):
email = urllib.unquote(email.replace(' ', ''))
if ';' in email:
emails2 = [x.strip() for x in email.split(';')]
else:
emails2 = [email]
for email2 in emails2:
emails.add(email2)
return list(emails)