-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkedIn_job_scrap.py
41 lines (26 loc) · 1.12 KB
/
LinkedIn_job_scrap.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
import requests
from bs4 import BeautifulSoup
import ssl
import csv
from csv import writer
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
#search for the job in linkedin and copy the url here
url = "https://www.linkedin.com/jobs/search/?f_E=6&geoId=102713980&keywords=data%20science&location=India"
html = requests.get(url)
soup = BeautifulSoup(str(html.content), 'html.parser')
filename = "LinkedIn_Result.csv"
csv_writer = csv.writer(open(filename, 'w'))
results = soup.find(class_='jobs-search__results-list')
print(soup.results)
with open(filename, 'w') as csv_file:
csv_writer = writer(csv_file)
headers = ['Title', 'Location', 'Company','Link']
csv_writer.writerow(headers)
for job_elem in results:
title = job_elem.find('span', class_='screen-reader-text').get_text()
location = job_elem.find('span', class_='job-result-card__location').get_text()
company = job_elem.find('h4', class_='result-card__subtitle').get_text()
link = job_elem.find("a")["href"]
csv_writer.writerow([title, location, company,link])