Skip to content

Commit 687bb4c

Browse files
authored
Merge pull request #84 from soxoj/yelp
Yelp added
2 parents cf54229 + 2d579ef commit 687bb4c

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [Unreleased]
44
* added username-from-email extractor
5+
* added Yelp
56

67
## [0.0.18] - 2021-05-04
78
* fixed and improved Behance

socid_extractor/postprocessor.py

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ def process(self):
5050

5151
class Email:
5252
def __init__(self, data):
53-
import logging
54-
logging.error(data)
5553
self.data = data
5654

5755
def process(self):

socid_extractor/schemes.py

+10
Original file line numberDiff line numberDiff line change
@@ -1333,5 +1333,15 @@
13331333
'location': lambda x: x['location']['city'] + ', ' + x['location']['country']['name'],
13341334
'created_at': lambda x: timestamp_to_datetime(x['registration_date']),
13351335
}
1336+
},
1337+
'Yelp': {
1338+
'flags': ['yelp.www.init.user_details'],
1339+
'bs': True,
1340+
'fields': {
1341+
'yelp_userid': lambda x: x.find('meta', {'property': 'og:url'}).get('content').split('=')[-1],
1342+
'fullname': lambda x: x.find('div', {'class': 'user-profile_info'}).find('h1').contents[0],
1343+
'location': lambda x: x.find('div', {'class': 'user-profile_info'}).find('h3').contents[0].split(' ', 1)[1],
1344+
'image': lambda x: x.find('div', {'class': 'user-profile_avatar'}).find('img').get('src'),
1345+
}
13361346
}
13371347
}

tests/test_e2e.py

+18
Original file line numberDiff line numberDiff line change
@@ -954,3 +954,21 @@ def test_freelancer():
954954
assert info.get('role') == 'freelancer'
955955
assert info.get('location') == 'Islamabad, Pakistan'
956956
assert info.get('created_at').startswith('2012-12-09')
957+
958+
959+
def test_yelp_username():
960+
info = extract(parse('http://dima.yelp.com')[0])
961+
962+
assert info.get('yelp_userid') == 'b_a5icXGK-AXVYZKehgKLw'
963+
assert info.get('fullname') == 'Dima "ZOMG" M.'
964+
assert info.get('location') == 'Brooklyn, NY'
965+
assert info.get('image') == 'https://s3-media0.fl.yelpcdn.com/photo/bGiNMDL6FZAtPpMfljRGtg/ls.jpg'
966+
967+
968+
def test_yelp_userid():
969+
info = extract(parse('https://www.yelp.com/user_details?userid=b_a5icXGK-AXVYZKehgKLw')[0])
970+
971+
assert info.get('yelp_userid') == 'b_a5icXGK-AXVYZKehgKLw'
972+
assert info.get('fullname') == 'Dima "ZOMG" M.'
973+
assert info.get('location') == 'Brooklyn, NY'
974+
assert info.get('image') == 'https://s3-media0.fl.yelpcdn.com/photo/bGiNMDL6FZAtPpMfljRGtg/ls.jpg'

0 commit comments

Comments
 (0)