This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
/
linkedin_search.py
61 lines (52 loc) · 2.06 KB
/
linkedin_search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from linkedin_api import Linkedin
def linkedin_search(name,pren):
try:
"""
a = search('"{} {}" -intitle:"profiles" -inurl:"dir/ " site:fr.linkedin.com/in/ OR site:fr.linkedin.com/pub/'.format(pren,name), lang="fr")
if len(a) > 0:
if name.lower() in a[0] and pren.lower() in a[0]:
return a[0]
else:
return None
"""
return None
except:
pass
def official_linkedin_search(name,pren):
username = ""
password = ""
if len(username) == 0:
return None
else:
api = Linkedin(username=username,password=password)
profile_data = api.search_people(keyword_first_name=pren,keyword_last_name=name)
if len(profile_data) == 0:
return None
else:
public_id = profile_data[0]['public_id']
urn_id = profile_data[0]['urn_id']
profile_infos = api.get_profile(urn_id=urn_id,public_id=public_id)
profile_contact = api.get_profile_contact_info(urn_id=urn_id,public_id=public_id)
email_adress = profile_contact['email_address']
twitters = profile_contact['twitter']
birthdate = profile_contact['birthdate']
phone_numbers = profile_contact['phone_numbers']
profile_infosz = api.get_profile(public_id)
location = profile_infosz['geoLocationName']
bio = profile_infosz['headline']
try:
job = (profile_infos['headline'])
except:
job = None
data = {
'Loc':location,
'Job':job,
'Bio':bio,
'email':email_adress,
'urnid':urn_id,
'url':'https://www.linkedin.com/in/'+public_id,
'twitters':twitters,
'birthdate':birthdate,
'phone_numbers':phone_numbers
}
return data