-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import re | ||
import requests | ||
from bs4 import BeautifulSoup | ||
from modules.base_logger import log | ||
from modules.common import getDomainName, updateExcel | ||
|
||
class JustJoinIt(): | ||
def __init__(self): | ||
self.jobs_dict = {} | ||
|
||
def updateJobsDict(self, url): | ||
domainName = getDomainName(url) | ||
try: | ||
page = requests.get(url, timeout=120) | ||
page_soup = BeautifulSoup(page.content, "html.parser") | ||
job_links_list = page_soup.find_all("div", {"class": "css-1iq2gw3"}) | ||
|
||
for job in job_links_list: | ||
job_link = "https://"+domainName+job.find('a', class_='css-4lqp8g')['href'] | ||
job_title = job.find('h2').text | ||
job_company = job.find('div', class_=re.compile("css-ldh1c9", re.I)).text | ||
job_salary = job.find('div', class_=re.compile("css-1b2ga3v", re.I)).text | ||
job_location = job.find('div', class_=re.compile("css-68pppj", re.I)).text | ||
self.jobs_dict[job_link] = {"Title": [job_title], | ||
"Company": [job_company], | ||
"Salary": [job_salary], | ||
"Location": [job_location]} | ||
except Exception as e: | ||
print(f"Exception {e} on updateJobsDict.") | ||
return None | ||
|
||
|
||
def run(sheetname, url): | ||
log.info("Starting JustJointIt scrapper.") | ||
just = JustJoinIt() | ||
just.updateJobsDict(url) | ||
updateExcel(sheetname, just.jobs_dict) | ||
log.info("Finished JustJoinIt scrapper.") |