geenral fix
This commit is contained in:
parent
fddfe5bb9c
commit
8a042217cb
2
gpt.py
2
gpt.py
@ -224,7 +224,7 @@ class GPTAnswerer:
|
|||||||
}
|
}
|
||||||
section_prompt = (
|
section_prompt = (
|
||||||
f"For the following question: '{question}', which section of the resume is relevant? "
|
f"For the following question: '{question}', which section of the resume is relevant? "
|
||||||
"Respond with one of the following: Personal information, Self-Identification, Legal Authorization, "
|
"Respond with one of the following: Personal information, Self Identification, Legal Authorization, "
|
||||||
"Work Preferences, Education Details, Experience Details, Projects, Availability, Salary Expectations, "
|
"Work Preferences, Education Details, Experience Details, Projects, Availability, Salary Expectations, "
|
||||||
"Certifications, Languages, Interests."
|
"Certifications, Languages, Interests."
|
||||||
)
|
)
|
||||||
|
@ -94,19 +94,24 @@ class LinkedInEasyApplier:
|
|||||||
def _fill_application_form(self):
|
def _fill_application_form(self):
|
||||||
while True:
|
while True:
|
||||||
self.fill_up()
|
self.fill_up()
|
||||||
self._next_or_submit()
|
if self._next_or_submit():
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def _next_or_submit(self):
|
def _next_or_submit(self):
|
||||||
next_button = self.driver.find_element(By.CLASS_NAME, "artdeco-button--primary")
|
next_button = self.driver.find_element(By.CLASS_NAME, "artdeco-button--primary")
|
||||||
button_text = next_button.text.lower()
|
button_text = next_button.text.lower()
|
||||||
if 'submit application' in button_text:
|
if 'submit application' in button_text:
|
||||||
self._unfollow_company()
|
self._unfollow_company()
|
||||||
|
next_button.click()
|
||||||
|
return True
|
||||||
time.sleep(random.uniform(1.5, 2.5))
|
time.sleep(random.uniform(1.5, 2.5))
|
||||||
next_button.click()
|
next_button.click()
|
||||||
time.sleep(random.uniform(3.0, 5.0))
|
time.sleep(random.uniform(3.0, 5.0))
|
||||||
self._check_for_errors()
|
self._check_for_errors()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _unfollow_company(self) -> None:
|
def _unfollow_company(self) -> None:
|
||||||
try:
|
try:
|
||||||
follow_checkbox = self.driver.find_element(
|
follow_checkbox = self.driver.find_element(
|
||||||
@ -130,10 +135,14 @@ class LinkedInEasyApplier:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def fill_up(self) -> None:
|
def fill_up(self) -> None:
|
||||||
easy_apply_content = self.driver.find_element(By.CLASS_NAME, 'jobs-easy-apply-content')
|
try:
|
||||||
pb4_elements = easy_apply_content.find_elements(By.CLASS_NAME, 'pb4')
|
easy_apply_content = self.driver.find_element(By.CLASS_NAME, 'jobs-easy-apply-content')
|
||||||
for element in pb4_elements:
|
pb4_elements = easy_apply_content.find_elements(By.CLASS_NAME, 'pb4')
|
||||||
self._process_form_element(element)
|
for element in pb4_elements:
|
||||||
|
self._process_form_element(element)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _process_form_element(self, element: WebElement) -> None:
|
def _process_form_element(self, element: WebElement) -> None:
|
||||||
|
@ -80,41 +80,41 @@ class LinkedInJobManager:
|
|||||||
for position, location in searches:
|
for position, location in searches:
|
||||||
location_url = "&location=" + location
|
location_url = "&location=" + location
|
||||||
job_page_number = -1
|
job_page_number = -1
|
||||||
print(f"Starting the search for {position} in {location}.")
|
utils.printyellow(f"Starting the search for {position} in {location}.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
page_sleep += 1
|
page_sleep += 1
|
||||||
job_page_number += 1
|
job_page_number += 1
|
||||||
print(f"Going to job page {job_page_number}")
|
utils.printyellow(f"Going to job page {job_page_number}")
|
||||||
self.next_job_page(position, location_url, job_page_number)
|
self.next_job_page(position, location_url, job_page_number)
|
||||||
time.sleep(random.uniform(1.5, 3.5))
|
time.sleep(random.uniform(1.5, 3.5))
|
||||||
print("Starting the application process for this page...")
|
utils.printyellow("Starting the application process for this page...")
|
||||||
self.apply_jobs()
|
self.apply_jobs()
|
||||||
print("Applying to jobs on this page has been completed!")
|
utils.printyellow("Applying to jobs on this page has been completed!")
|
||||||
|
|
||||||
time_left = minimum_page_time - time.time()
|
time_left = minimum_page_time - time.time()
|
||||||
if time_left > 0:
|
if time_left > 0:
|
||||||
print(f"Sleeping for {time_left} seconds.")
|
utils.printyellow(f"Sleeping for {time_left} seconds.")
|
||||||
time.sleep(time_left)
|
time.sleep(time_left)
|
||||||
minimum_page_time = time.time() + minimum_time
|
minimum_page_time = time.time() + minimum_time
|
||||||
if page_sleep % 5 == 0:
|
if page_sleep % 5 == 0:
|
||||||
sleep_time = random.randint(5, 34)
|
sleep_time = random.randint(5, 34)
|
||||||
print(f"Sleeping for {sleep_time / 60} minutes.")
|
utils.printyellow(f"Sleeping for {sleep_time / 60} minutes.")
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
page_sleep += 1
|
page_sleep += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.format_exc()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
time_left = minimum_page_time - time.time()
|
time_left = minimum_page_time - time.time()
|
||||||
if time_left > 0:
|
if time_left > 0:
|
||||||
print(f"Sleeping for {time_left} seconds.")
|
utils.printyellow(f"Sleeping for {time_left} seconds.")
|
||||||
time.sleep(time_left)
|
time.sleep(time_left)
|
||||||
minimum_page_time = time.time() + minimum_time
|
minimum_page_time = time.time() + minimum_time
|
||||||
if page_sleep % 5 == 0:
|
if page_sleep % 5 == 0:
|
||||||
sleep_time = random.randint(50, 90)
|
sleep_time = random.randint(50, 90)
|
||||||
print(f"Sleeping for {sleep_time / 60} minutes.")
|
utils.printyellow(f"Sleeping for {sleep_time / 60} minutes.")
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
page_sleep += 1
|
page_sleep += 1
|
||||||
|
|
||||||
@ -140,20 +140,21 @@ class LinkedInJobManager:
|
|||||||
|
|
||||||
for job in job_list:
|
for job in job_list:
|
||||||
if self.is_blacklisted(job.title, job.company, job.link):
|
if self.is_blacklisted(job.title, job.company, job.link):
|
||||||
print(f"Blacklisted {job.title} at {job.company}, skipping...")
|
utils.printyellow(f"Blacklisted {job.title} at {job.company}, skipping...")
|
||||||
self.write_to_file(job.company, job.location, job.title, job.link, "skipped")
|
self.write_to_file(job.company, job.location, job.title, job.link, "skipped")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if job.apply_method not in {"Continue", "Applied", "Apply"}:
|
if job.apply_method not in {"Continue", "Applied", "Apply"}:
|
||||||
self.easy_applier_component.job_apply(job)
|
self.easy_applier_component.job_apply(job)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
utils.printred(traceback.format_exc())
|
||||||
self.write_to_file(job.company, job.location, job.title, job.link, "failed")
|
self.write_to_file(job.company, job.location, job.title, job.link, "failed")
|
||||||
continue
|
continue
|
||||||
self.write_to_file(job.company, job.location, job.title, job.link, "success")
|
self.write_to_file(job.company, job.location, job.title, job.link, "success")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.format_exc()
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
def write_to_file(self, company, job_title, link, job_location, file_name):
|
def write_to_file(self, company, job_title, link, job_location, file_name):
|
||||||
@ -171,8 +172,8 @@ class LinkedInJobManager:
|
|||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
writer.writerow(to_write)
|
writer.writerow(to_write)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error writing registered job: {e}")
|
utils.printred(f"Error writing registered job: {e}")
|
||||||
print(f"Details: Answer type: {answer_type}, Question: {question_text}")
|
utils.printred(f"Details: Answer type: {answer_type}, Question: {question_text}")
|
||||||
|
|
||||||
def get_base_search_url(self, parameters):
|
def get_base_search_url(self, parameters):
|
||||||
remote_url = "f_CF=f_WRA" if parameters['remote'] else ""
|
remote_url = "f_CF=f_WRA" if parameters['remote'] else ""
|
||||||
|
14
utils.py
14
utils.py
@ -66,3 +66,17 @@ def chromeBrowserOptions():
|
|||||||
else:
|
else:
|
||||||
options.add_argument("--incognito")
|
options.add_argument("--incognito")
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
def printred(text):
|
||||||
|
# Codice colore ANSI per il rosso
|
||||||
|
RED = "\033[91m"
|
||||||
|
RESET = "\033[0m"
|
||||||
|
# Stampa il testo in rosso
|
||||||
|
print(f"{RED}{text}{RESET}")
|
||||||
|
|
||||||
|
def printyellow(text):
|
||||||
|
# Codice colore ANSI per il giallo
|
||||||
|
YELLOW = "\033[93m"
|
||||||
|
RESET = "\033[0m"
|
||||||
|
# Stampa il testo in giallo
|
||||||
|
print(f"{YELLOW}{text}{RESET}")
|
Loading…
Reference in New Issue
Block a user