Jobs_Applier_AI_Agent_AIHawk icon indicating copy to clipboard operation
Jobs_Applier_AI_Agent_AIHawk copied to clipboard

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

Open RohanBera opened this issue 1 year ago • 1 comments

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?

RohanBera avatar Sep 21 '24 00:09 RohanBera

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

queukat avatar Oct 08 '24 08:10 queukat