Skip to content

Commit

Permalink
Merge pull request #170 from aram-wealthmore/experience_level_filter
Browse files Browse the repository at this point in the history
add experience level to config and adjust easyapplybot.py to handle t…
  • Loading branch information
nicolomantini authored May 26, 2024
2 parents a1e14f9 + 0ffb7b9 commit c3af89f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
8 changes: 8 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ output_filename:

# blacklist:
# - # Company names you want to ignore

experience_level:
# - 1 # Entry level
# - 2 # Associate
# - 3 # Mid-Senior level
# - 4 # Director
# - 5 # Executive
# - 6 # Internship
40 changes: 32 additions & 8 deletions easyapplybot.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,28 @@ def __init__(self,
uploads={},
filename='output.csv',
blacklist=[],
blackListTitles=[]) -> None:
blackListTitles=[],
experience_level=[]
) -> None:

log.info("Welcome to Easy Apply Bot")
dirpath: str = os.getcwd()
log.info("current directory is : " + dirpath)
log.info("Please wait while we prepare the bot for you")
if experience_level:
experience_levels = {
1: "Entry level",
2: "Associate",
3: "Mid-Senior level",
4: "Director",
5: "Executive",
6: "Internship"
}
applied_levels = [experience_levels[level] for level in experience_level]
log.info("Applying for experience level roles: " + ", ".join(applied_levels))
else:
log.info("Applying for all experience levels")


self.uploads = uploads
self.salary = salary
Expand All @@ -84,6 +101,7 @@ def __init__(self,
self.blackListTitles = blackListTitles
self.start_linkedin(username, password)
self.phone_number = phone_number
self.experience_level = experience_level


self.locator = {
Expand Down Expand Up @@ -215,7 +233,7 @@ def applications_loop(self, position, location):

self.browser.set_window_position(1, 1)
self.browser.maximize_window()
self.browser, _ = self.next_jobs_page(position, location, jobs_per_page)
self.browser, _ = self.next_jobs_page(position, location, jobs_per_page, experience_level=self.experience_level)
log.info("Looking for jobs.. Please wait..")

while time.time() - start_time < self.MAX_SEARCH_TIME:
Expand Down Expand Up @@ -266,11 +284,13 @@ def applications_loop(self, position, location):
self.apply_loop(jobIDs)
self.browser, jobs_per_page = self.next_jobs_page(position,
location,
jobs_per_page)
jobs_per_page,
experience_level=self.experience_level)
else:
self.browser, jobs_per_page = self.next_jobs_page(position,
location,
jobs_per_page)
jobs_per_page,
experience_level=self.experience_level)


except Exception as e:
Expand Down Expand Up @@ -639,11 +659,14 @@ def avoid_lock(self) -> None:
time.sleep(0.5)
pyautogui.press('esc')

def next_jobs_page(self, position, location, jobs_per_page):
def next_jobs_page(self, position, location, jobs_per_page, experience_level=[]):
# Construct the experience level part of the URL
experience_level_str = ",".join(map(str, experience_level)) if experience_level else ""
experience_level_param = f"&f_E={experience_level_str}" if experience_level_str else ""
self.browser.get(
# URL for jobs page
"https://www.linkedin.com/jobs/search/?f_LF=f_AL&keywords=" +
position + location + "&start=" + str(jobs_per_page))
position + location + "&start=" + str(jobs_per_page) + experience_level_param)
#self.avoid_lock()
log.info("Loading next job page?")
self.load_page()
Expand Down Expand Up @@ -691,11 +714,12 @@ def next_jobs_page(self, position, location, jobs_per_page):
parameters['password'],
parameters['phone_number'],
parameters['salary'],
parameters['rate'],
parameters['rate'],
uploads=uploads,
filename=output_filename,
blacklist=blacklist,
blackListTitles=blackListTitles
blackListTitles=blackListTitles,
experience_level=parameters.get('experience_level', [])
)
bot.start_apply(positions, locations)

Expand Down

0 comments on commit c3af89f

Please sign in to comment.