Skip to content

Commit 910ae41

Browse files
author
Lin Wang
committed
Linkedin page_download first try
1 parent c56cf0d commit 910ae41

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

KESolutions/linkedinsearch.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ def find_contact(fname, sname, company, sleepTime, browser):
2828
file.close()
2929

3030
try:
31-
chunks = source.split('<ul class="results-list">')[1].split('</ul>')[0]
31+
chunks = source.split('<ul class="search-results__list list-style-none mt2">')[1].split('</ul>')[0]
3232
urls = []
33-
for i in chunks.split('href="/in/')[1:]:
34-
urlChunk = i.split('/"')[0]
33+
for j in chunks.split('href="/in/')[1:]:
34+
urlChunk = j.split('/"')[0]
3535
url = 'https://www.linkedin.com/in/' + urlChunk + '/'
3636
urls.append(url)
3737

38-
download_page(urls[0],fname+'.'+sname,sleepTime,browser)
38+
download_page(urls[0], fname+'.'+sname, sleepTime, browser)
39+
print('This place is executed')
3940
except:
4041
print('No profile found')
41-
time.sleep(60)
42+
time.sleep(20)
4243
file = open('newFailedScrapes.csv', 'a')
4344
file.write(fname + ',' + sname + ',' + company + '\n')
4445
file.close()
@@ -49,6 +50,7 @@ def download_page(link, sname, sleepTime, browser):
4950
browser.get(link)
5051
browser.maximize_window()
5152
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
53+
print('scrolled')
5254
browser.find_element_by_class_name('pv-skills-section__chevron-icon').click()
5355
browser.find_element_by_class_name('pv-profile-section__toggle-detail-icon').click()# all the stuff that user liked and shared
5456
browser.find_elements_by_class_name('pv-profile-section__toggle-detail-icon')[4].click() # languages
@@ -62,10 +64,6 @@ def download_page(link, sname, sleepTime, browser):
6264
html_file.close()
6365

6466

65-
# link = 'https://www.linkedin.com/in/cmagsisi/'
66-
# download_page(link, 'perhar', 5, browser)
67-
68-
6967
if __name__ == "__main__":
7068
browser.get('http://www.linkedin.com')
7169
time.sleep(60)

KESolutions/newClientsRogers.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
First Name,Last Name,Company
2-
Shuming,Jia,Compass Digital Lab
3-
Gurbir,Perhar,Compass Digital Lab
2+
Shuming,Jia,Compass Digital Labs
3+
Gurbir,Perhar,Compass Digital Labs
44
Guangyi,Zhang,
55
Robb,Gilbert,
66
Zhejian,Zhao,

KESolutions/newFailedScrapes.csv

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
firstName,lastName,company
2-
Last Name,First Name,Company
3-
Jia,Shuming,Compass Digital Lab
4-
Perhar,Gurbir,Compass Digital Lab
5-
Zhang,Guangyi,
6-
Gilbert,Robb,
7-
Zhao,Zhejian,
8-
Wu,Patrick,
9-
Liang,Tina,
2+
Shuming,Jia,Compass Digital Labs
3+
Gurbir,Perhar,Compass Digital Labs
4+
Guangyi,Zhang,
5+
Robb,Gilbert,
6+
Zhejian,Zhao,
7+
Patrick,Wu,
8+
Tina,Liang,

0 commit comments

Comments
 (0)