Skip to content

Commit 7480a5c

Browse files
authored
Merge pull request #89 from soxoj/emails-postprocessor-bugfix
Bugfix on invalid email extractions
2 parents b6625f9 + a416229 commit 7480a5c

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

socid_extractor/postprocessor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def process(self):
5656
output = {}
5757

5858
for k, v in self.data.items():
59+
if v.startswith('[') or v.startswith("'"):
60+
continue
5961
if 'email' in k and '@' in v:
6062
new_k = k + '_username'
6163
supposed_username = v.split('@')[0]

tests/test_e2e.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def test_deviantart():
536536
assert info.get(
537537
'links') == "['https://www.instagram.com/muse.mercier/']"
538538
assert info.get('tagline') == 'Nothing worth having is easy...'
539-
assert info.get('bio').startswith('Hi my name is Muse Mercier and welcome to my') is True
539+
assert info.get('bio').startswith('Hi! My name is Muse Mercier,') is True
540540
assert info.get('created_at').startswith('2005-06-16')
541541

542542

@@ -588,6 +588,7 @@ def test_gravatar():
588588
assert info.get('emails') == "['k.bx@ya.ru']"
589589
assert info.get('image') == 'https://secure.gravatar.com/avatar/d6ac4c55425d6f9d28db9068dbb49e09'
590590
assert info.get('links') == "['http://twitter.com/kost_bebix']"
591+
assert 'emails_username' not in info
591592

592593

593594
def test_pinterest_api():
@@ -985,6 +986,7 @@ def test_trello():
985986
assert info.get("is_verified") == "True"
986987

987988

989+
@pytest.mark.github_failed
988990
def test_weibo():
989991
headers = {"cookie": "SUB=_2AkMXyuc_f8NxqwJRmP8SyWPrbo13zAvEieKhlhbkJRMxHRl-123", "cache-control": "no-cache"}
990992
info = extract(parse('https://weibo.com/clairekuo?is_all=1', headers=headers, timeout=10)[0])

0 commit comments

Comments
 (0)