feder-cr / Auto_Jobs_Applier_AIHawk

Auto_Jobs_Applier_AIHawk is a tool that automates the jobs application process. Utilizing artificial intelligence, it enables users to apply for multiple job offers in an automated and personalized way.
Other
17.49k stars 2.54k forks source link

Bot keeps failing on the same jobs and Title black list does not work unless its in lower case. #413

Open RohanBera opened 3 weeks ago

RohanBera commented 3 weeks ago

The Bot is revisiting jobs it failed on and fails again. It would be nice to have a function that does not apply to jobs it previously failed on!

Also, titleBlackList does not work when the titles are not in lowercase.

This code seems to work: (src/linkedin_job_manager.py)

    # UPDATED FUNCTION
    def is_blacklisted(self, job_title, company, link):
        job_title_words = job_title.lower().split(" ")
        title_blacklisted = any(
            # CHANGE (converts blacklisted titles to lowercase)
            word.lower() in self.title_blacklist for word in job_title_words
        )
        company_blacklisted = company.strip().lower() in (
            word.strip().lower() for word in self.company_blacklist
        )
        # CHANGE 
        link_seen = link in self.get_all_failed_links()

        if link_seen:
            print("Link already seen...")
        elif title_blacklisted:
            print("title blacklisted...")
        elif company_blacklisted:
            print("company blacklisted")

        return title_blacklisted or company_blacklisted or link_seen

    # NEW FUNCTION
    def get_all_failed_links(self):
        try:
            with open("./data_folder/output/failed.json") as f:
                data = json.load(f)
            links = [entry["link"] for entry in data]
            return links
        except FileNotFoundError:
            print("failed.json not found. Returning an empty list.")
            return []
        except json.JSONDecodeError:
            print("Error decoding JSON from failed.json. Returning an empty list.")
            return []
        except Exception as e:
            print(f"Unexpected error: {e}. Returning an empty list.")
            return []

I did notice an empty array initialized in the param seen_jobs, but I don't think the param is being used, is it?

queukat commented 6 days ago

fixed in https://github.com/feder-cr/Auto_Jobs_Applier_AIHawk/pull/473