Merge branch 'v3' into v3

This commit is contained in:
queukat 2024-09-07 14:23:03 +03:00 committed by GitHub
commit 0f48cb1e1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 1293 additions and 46 deletions

65
.github/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,65 @@
# Issues Reporting Guidelines
Welcome to the LinkedIn Auto Jobs Applier with AI issues page! To keep things organized and ensure issues are resolved quickly, please follow the guidelines below when submitting a bug report, feature request, or any other issue.
## Before You Submit an Issue
### 1. Search Existing Issues
Please search through the existing open issues and closed issues to ensure your issue hasnt already been reported. This helps avoid duplicates and allows us to focus on unresolved problems.
### 2. Check Documentation
Review the README and any available documentation to see if your issue is covered.
### 3. Provide Detailed Information
If you are reporting a bug, make sure you include enough details to reproduce the issue. The more information you provide, the faster we can diagnose and fix the problem.
## Issue Types
### 1. Bug Reports
Please include the following information:
- **Description:** A clear and concise description of the problem.
- **Steps to Reproduce:** Provide detailed steps to reproduce the bug.
- **Expected Behavior:** What should have happened.
- **Actual Behavior:** What actually happened.
- **Environment Details:** Include your OS, browser version (if applicable), and any other relevant environment details.
- **Logs/Screenshots:** If applicable, attach screenshots or log outputs.
### 2. Feature Requests
For new features or improvements:
- Clearly describe the feature you would like to see.
- Explain the problem this feature would solve or the benefit it would bring.
- If possible, provide examples or references to similar features in other tools or platforms.
### 3. Questions/Discussions
- If youre unsure whether something is a bug or if youre seeking clarification on functionality, you can ask a question. Please make sure to label your issue as a question.
## Issue Labeling and Response Time
We use the following labels to categorize issues:
- **bug:** An issue where something isn't functioning as expected.
- **documentation:** Improvements or additions to project documentation.
- **duplicate:** This issue or pull request already exists elsewhere.
- **enhancement:** A request for a new feature or improvement.
- **good first issue:** A simple issue suitable for newcomers.
- **help wanted:** The issue needs extra attention or assistance.
- **invalid:** The issue is not valid or doesn't seem correct.
- **question:** Additional information or clarification is needed.
- **wontfix:** The issue will not be fixed or addressed.
- We aim to respond to issues as early as possible. Please be patient, as maintainers may have limited availability.
## Contributing Fixes
If youre able to contribute a fix for an issue:
1. Fork the repository and create a new branch for your fix.
2. Reference the issue number in your branch and pull request.
3. Submit a pull request with a detailed description of the changes and how they resolve the issue.

68
.github/ISSUE_TEMPLATE/bug-issue.yml vendored Normal file
View file

@ -0,0 +1,68 @@
name: Bug report
description: Report a bug or an issue that isn't working as expected.
title: "[BUG]: <Provide a clear, descriptive title>"
labels: ["bug"]
assignees: []
body:
- type: markdown
attributes:
value: |
Please fill out the following information to help us resolve the issue.
- type: input
id: description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
placeholder: "Describe the bug in detail..."
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: |
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
placeholder: "List the steps to reproduce the bug..."
- type: input
id: expected
attributes:
label: Expected behavior
description: What you expected to happen.
placeholder: "What was the expected result?"
- type: input
id: actual
attributes:
label: Actual behavior
description: What actually happened instead.
placeholder: "What happened instead?"
- type: dropdown
id: environment
attributes:
label: Environment
description: Specify the environment where the bug occurred.
options:
- Production
- Development
- Staging
- type: input
id: version
attributes:
label: Version
description: Version of the application where the bug occurred.
placeholder: "e.g., 1.0.0"
- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context about the problem here.
placeholder: "Any additional information..."

9
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,9 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: t.me/AIhawkCommunity
about: You can join the discussions on Telegram.
- name: New issue
url: >-
https://github.com/feder-cr/linkedIn_auto_jobs_applier_with_AI/blob/v3/.github/CONTRIBUTING.md
about: "Before opening a new issue, please make sure to read CONTRIBUTING.md"

View file

@ -0,0 +1,39 @@
name: Documentation request
description: Suggest improvements or additions to the project's documentation.
title: "[DOCS]: <Provide a short title>"
labels: ["documentation"]
assignees: []
body:
- type: markdown
attributes:
value: |
Thanks for helping to improve the project's documentation! Please provide the following details to ensure your request is clear.
- type: input
id: doc_section
attributes:
label: Affected documentation section
description: Specify which part of the documentation needs improvement or addition.
placeholder: "e.g., Installation Guide, API Reference..."
- type: textarea
id: description
attributes:
label: Documentation improvement description
description: Describe the specific improvements or additions you suggest.
placeholder: "Explain what changes you propose and why..."
- type: input
id: reason
attributes:
label: Why is this change necessary?
description: Explain why the documentation needs to be updated or expanded.
placeholder: "Describe the issue or gap in the documentation..."
- type: input
id: additional
attributes:
label: Additional context
description: Add any other context, such as related documentation, external resources, or screenshots.
placeholder: "Add any other supporting information..."

View file

@ -0,0 +1,32 @@
name: Duplicate issue report
description: Report an issue or pull request that already exists in the project.
title: "[DUPLICATE]: <Provide a brief title>"
labels: ["duplicate"]
assignees: []
body:
- type: markdown
attributes:
value: |
Please provide information about the duplicate issue or pull request.
- type: input
id: duplicate_link
attributes:
label: Link to the original issue/pull request
description: Provide the URL of the original issue or pull request that duplicates this one.
placeholder: "https://github.com/your-repo/issue/123"
- type: input
id: reason
attributes:
label: Reason for marking as duplicate
description: Explain why this issue is considered a duplicate.
placeholder: "Briefly explain why this is a duplicate."
- type: input
id: additional
attributes:
label: Additional context
description: Add any additional context or supporting information.
placeholder: "Any additional information or comments..."

View file

@ -0,0 +1,46 @@
name: Feature request
description: Suggest a new feature or improvement for the project.
title: "[FEATURE]: <Provide a descriptive title>"
labels: ["enhancement"]
assignees: []
body:
- type: markdown
attributes:
value: |
Thank you for suggesting a feature! Please fill out the form below to help us understand your idea.
- type: input
id: summary
attributes:
label: Feature summary
description: Provide a short summary of the feature you're requesting.
placeholder: "Summarize the feature in a few words..."
- type: textarea
id: description
attributes:
label: Feature description
description: A detailed description of the feature or improvement.
placeholder: "Describe the feature in detail..."
- type: input
id: motivation
attributes:
label: Motivation
description: Explain why this feature would be beneficial and how it solves a problem.
placeholder: "Why do you need this feature?"
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
description: List any alternative solutions or features you've considered.
placeholder: "Are there any alternative features or solutions youve considered?"
- type: input
id: additional
attributes:
label: Additional context
description: Add any other context or screenshots to support your feature request.
placeholder: "Any additional information..."

View file

@ -0,0 +1,46 @@
name: Good first issue
description: Suitable for newcomers or those new to the project.
title: "[GOOD FIRST ISSUE]: <Provide a descriptive title>"
labels: ["good first issue"]
assignees: []
body:
- type: markdown
attributes:
value: |
Welcome to contributing to our project! This issue is marked as a "Good First Issue," which means it is a great starting point for new contributors. Please provide the following information to help us understand your issue.
- type: input
id: issue_summary
attributes:
label: Issue summary
description: Provide a brief summary of the issue or task.
placeholder: "Summarize the issue or task..."
- type: textarea
id: detailed_description
attributes:
label: Detailed description
description: Provide a detailed description of what needs to be done, including any relevant background information or steps.
placeholder: "Describe the issue or task in detail, including any relevant information..."
- type: input
id: steps_to_reproduce
attributes:
label: Steps to reproduce (if applicable)
description: If this issue involves a bug, list the steps to reproduce the problem.
placeholder: "List the steps to reproduce the issue (if applicable)..."
- type: input
id: expected_outcome
attributes:
label: Expected outcome
description: Describe what you expect to happen once the issue is resolved.
placeholder: "Describe the expected outcome..."
- type: input
id: additional_context
attributes:
label: Additional context
description: Add any other context or information that might be helpful for resolving the issue.
placeholder: "Any additional information or comments..."

39
.github/ISSUE_TEMPLATE/help-issue.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Help wanted
description: Request additional help or attention for an issue that needs extra effort.
title: "[HELP WANTED]: <Provide a descriptive title>"
labels: ["help wanted"]
assignees: []
body:
- type: markdown
attributes:
value: |
We need additional help with this issue. Please provide as much detail as possible to assist contributors.
- type: textarea
id: issue_description
attributes:
label: Issue description
description: Provide a detailed description of the issue and what kind of help is needed.
placeholder: "Describe the issue and the type of help required..."
- type: input
id: specific_tasks
attributes:
label: Specific tasks
description: List any specific tasks or sub-tasks where help is needed.
placeholder: "List specific tasks or areas where help is needed..."
- type: input
id: additional_resources
attributes:
label: Additional resources
description: Provide links to related documentation, resources, or references that might help contributors.
placeholder: "Link to relevant resources or documentation..."
- type: input
id: additional
attributes:
label: Additional context
description: Add any extra information or context that might help in addressing the issue.
placeholder: "Any additional information or comments..."

View file

@ -0,0 +1,39 @@
name: Invalid issue report
description: Report an issue that doesn't seem correct or is invalid.
title: "[INVALID]: <Provide a brief title>"
labels: ["invalid"]
assignees: []
body:
- type: markdown
attributes:
value: |
If you've identified an issue that seems incorrect or should not exist, please fill out the form below to provide more details.
- type: input
id: reason
attributes:
label: Reason for invalidation
description: Briefly explain why this issue is considered invalid or incorrect.
placeholder: "Why do you think this issue is invalid?"
- type: textarea
id: steps
attributes:
label: Steps to validate
description: Provide steps or evidence that confirm the issue is invalid.
placeholder: "Explain how you verified this issue is not valid..."
- type: input
id: original_issue
attributes:
label: Related issue (if applicable)
description: Provide a link to the original issue if this is related to an existing one.
placeholder: "Link to the related issue (if applicable)"
- type: input
id: additional
attributes:
label: Additional context
description: Any additional information you think is necessary.
placeholder: "Add any other context here..."

View file

@ -0,0 +1,39 @@
name: Question or Information Request
description: Ask a question or request more information related to the project.
title: "[QUESTION]: <Provide a short title>"
labels: ["question"]
assignees: []
body:
- type: markdown
attributes:
value: |
Please fill out the form below to ask your question or request further information.
- type: input
id: question_summary
attributes:
label: Summary of your question
description: Provide a brief summary of your question or information request.
placeholder: "Summarize your question in a few words..."
- type: textarea
id: question_details
attributes:
label: Question details
description: Provide a detailed explanation of your question or what information you're requesting.
placeholder: "Describe your question or information request in detail..."
- type: input
id: context
attributes:
label: Context for the question
description: Provide any relevant context or background information that may help clarify your question.
placeholder: "Add context for your question (e.g., where you encountered the issue, what you're trying to do)..."
- type: input
id: additional
attributes:
label: Additional context
description: Add any additional information that may help answer your question.
placeholder: "Any extra information or comments..."

View file

@ -0,0 +1,32 @@
name: Won't fix
description: Mark an issue as won't fix if it will not be addressed or resolved.
title: "[WONTFIX]: <Provide a brief title>"
labels: ["wontfix"]
assignees: []
body:
- type: markdown
attributes:
value: |
This issue will not be fixed. Please provide reasons or context for why the issue is being closed as won't fix.
- type: textarea
id: reason
attributes:
label: Reason for won't fix
description: Explain why this issue will not be fixed or addressed.
placeholder: "Describe the reason why this issue is being marked as won't fix..."
- type: input
id: decision_maker
attributes:
label: Decision maker
description: Specify who made the decision to mark the issue as won't fix.
placeholder: "Name of the person or team responsible for this decision..."
- type: input
id: additional
attributes:
label: Additional context
description: Add any other context or information relevant to the decision.
placeholder: "Any additional information or comments..."

1
.gitignore vendored
View file

@ -11,3 +11,4 @@ generated_cv*
.vscode
chrome_profile
answers.json
data*

130
README.md
View file

@ -148,11 +148,15 @@ This file contains sensitive information. Never share or commit this file to ver
- Replace with your LinkedIn account email address
- `password: [Your LinkedIn password]`
- Replace with your LinkedIn account password
- `openai_api_key: [Your OpenAI API key]`
- `llm_api_key: [Your OpenAI or Ollama API key]`
- Replace with your OpenAI API key for GPT integration
- To obtain an API key, follow the tutorial at: https://medium.com/@lorenzozar/how-to-get-your-own-openai-api-key-f4d44e60c327
- Note: You need to add credit to your OpenAI account to use the API. You can add credit by visiting the [OpenAI billing dashboard](https://platform.openai.com/account/billing).
- According to the [OpenAI community](https://community.openai.com/t/usage-tier-free-to-tier-1/919150) and our users' reports, right after setting up the OpenAI account and purchasing the required credits, users still have a `Free` account type. This prevents them from having unlimited access to OpenAI models and allows only 200 requests per day. This might cause runtime errors such as:
`Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. ...}}`
`{'error': {'message': 'Rate limit reached for gpt-4o-mini in organization <org> on requests per day (RPD): Limit 200, Used 200, Requested 1.}}`
OpenAI will update your account automatically, but it might take some time, ranging from a couple of hours to a few days.
You can find more about your organization limits on the [official page](https://platform.openai.com/settings/organization/limits).
### 2. config.yaml
@ -189,6 +193,8 @@ This file defines your job search parameters and bot behavior. Each section cont
- Italy
- London
```
- `applyOnceAtCompany: [True/False]`
- Set if you will apply in more than one opportunity per company
- `distance: [number]`
- Set the radius for your job search in miles
@ -211,7 +217,22 @@ This file defines your job search parameters and bot behavior. Each section cont
- Sales
- Marketing
```
#### 2.1 config.yaml - Customize LLM model endpoint
- `llm_model_type`:
- Choose the model type, supported: openai / ollama / claude
- `llm_model`:
- Choose the LLM model, currently supported:
- openai: gpt-4o
- ollama: llama2, mistral:v0.3
- claude: any model
- `llm_api_url`:
- Link of the API endpoint for the LLM model
- openai: https://api.pawan.krd/cosmosrp/v1
- ollama: http://127.0.0.1:11434/
- claude: https://api.anthropic.com/v1
- Note: To run local Ollama, follow the guidelines here: [Guide to Ollama deployment](https://github.com/ollama/ollama)
### 3. plain_text_resume.yaml
This file contains your resume information in a structured format. Fill it out with your personal details, education, work experience, and skills. This information is used to auto-fill application forms and generate customized resumes.
@ -452,6 +473,27 @@ Each section has specific fields to fill out:
willing_to_undergo_drug_tests: "No"
willing_to_undergo_background_checks: "Yes"
```
### 4. Generating plain_text_resume.yaml from a PDF or Text Resume
To simplify the process of creating your `plain_text_resume.yaml` file, you can use the provided script to generate it from a pdf-based or text-based resume. Follow these steps:
1. Prepare your resume in a pdf (.pdf file) or plain text (.txt file) format.
2. Place your resume in the `data_folder` directory.
3. Run the following command:
```bash
python generate_resume_yaml.py --input data_folder/your_resume.[pdf|txt] --output data_folder/plain_text_resume.yaml
```
Replace `your_resume.[pdf|txt]` with the actual name of your pdf or text resume file.
4. The script will generate a `plain_text_resume.yaml` file in the `data_folder` directory.
5. Review the generated YAML file and make any necessary adjustments to ensure all information is correct and complete.
This automated process helps in creating a structured YAML file from your existing resume, saving time and reducing the chance of errors in manual data entry.
### PLUS. data_folder_example
@ -501,19 +543,83 @@ Using this folder as a guide can be particularly helpful for:
python main.py --resume /path/to/your/resume.pdf
```
## Documentation
TODO ):
### Troubleshooting Common Issues
#### 1. OpenAI API Rate Limit Errors
**Error Message:**
openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}
**Solution:**
- Check your OpenAI API billing settings at https://platform.openai.com/account/billing
- Ensure you have added a valid payment method to your OpenAI account
- Note that ChatGPT Plus subscription is different from API access
- If you've recently added funds or upgraded, wait 12-24 hours for changes to take effect
- Free tier has a 3 RPM limit; spend at least $5 on API usage to increase
#### 2. LinkedIn Easy Apply Button Not Found
**Error Message:**
Exception: No clickable 'Easy Apply' button found
**Solution:**
- Ensure that you're logged into LinkedIn properly
- Check if the job listings you're targeting actually have the "Easy Apply" option
- Verify that your search parameters in the `config.yaml` file are correct and returning jobs with the "Easy Apply" button
- Try increasing the wait time for page loading in the script to ensure all elements are loaded before searching for the button
#### 3. Incorrect Information in Job Applications
**Issue:** Bot provides inaccurate data for experience, CTC, and notice period
**Solution:**
- Update prompts for professional experience specificity
- Add fields in `config.yaml` for current CTC, expected CTC, and notice period
- Modify bot logic to use these new config fields
#### 4. YAML Configuration Errors
**Error Message:**
yaml.scanner.ScannerError: while scanning a simple key
**Solution:**
- Copy example `config.yaml` and modify gradually
- Ensure proper YAML indentation and spacing
- Use a YAML validator tool
- Avoid unnecessary special characters or quotes
#### 5. Bot Logs In But Doesn't Apply to Jobs
**Issue:** Bot searches for jobs but continues scrolling without applying
**Solution:**
- Check for security checks or CAPTCHAs
- Verify `config.yaml` job search parameters
- Ensure your LinkedIn profile meets job requirements
- Review console output for error messages
### General Troubleshooting Tips
- Use the latest version of the script
- Verify all dependencies are installed and updated
- Check internet connection stability
- Use VPNs cautiously to avoid triggering LinkedIn security
- Clear browser cache and cookies if issues persist
For further assistance, please create an issue on the [GitHub repository](https://github.com/feder-cr/LinkedIn_AIHawk_automatic_job_application/issues) with detailed information about your problem, including error messages and your configuration (with sensitive information removed).
### Additional Resources
- [Video Tutorial: How to set up LinkedIn_AIHawk](https://youtu.be/gdW9wogHEUM)
- [OpenAI API Documentation](https://platform.openai.com/docs/)
- [LinkedIn Developer Documentation](https://developer.linkedin.com/)
- [Lang Chain Developer Documentation](https://python.langchain.com/v0.2/docs/integrations/components/)
## Troubleshooting
- **Carefully read logs and output :** Most of the errors are verbosely reflected just watch the output and try to find the root couse.
- **If nothing works by unknown reason:** Use tested OS. Reboot and/or update OS. Use new clean venv. Try update Python to the tested version.
- **ChromeDriver Issues:** Ensure ChromeDriver is compatible with your installed Chrome version.
- **Missing Files:** Verify that all necessary files are present in the data folder.
- **Invalid YAML:** Check your YAML files for syntax errors . Try to use external YAML validators e.g. https://www.yamllint.com/
- **OpenAI endpoint isues**: Try to check possible limits\blocking at their side
If you encounter any issues, you can open an issue on [GitHub](https://github.com/feder-cr/linkedIn_auto_jobs_applier_with_AI/issues).
Please add valuable details to the subject and to the description. If you need new feature then please reflect this.
I'll be more than happy to assist you!

132
assets/resume_schema.yaml Normal file
View file

@ -0,0 +1,132 @@
# YAML Schema for plain_text_resume.yaml
personal_information:
type: object
properties:
name: {type: string}
surname: {type: string}
date_of_birth: {type: string, format: date}
country: {type: string}
city: {type: string}
address: {type: string}
phone_prefix: {type: string, format: phone_prefix}
phone: {type: string, format: phone}
email: {type: string, format: email}
github: {type: string, format: uri}
linkedin: {type: string, format: uri}
required: [name, surname, date_of_birth, country, city, address, phone_prefix, phone, email]
education_details:
type: array
items:
type: object
properties:
degree: {type: string}
university: {type: string}
gpa: {type: string}
graduation_year: {type: string}
field_of_study: {type: string}
exam:
type: object
additionalProperties: {type: string}
required: [degree, university, gpa, graduation_year, field_of_study]
experience_details:
type: array
items:
type: object
properties:
position: {type: string}
company: {type: string}
employment_period: {type: string}
location: {type: string}
industry: {type: string}
key_responsibilities:
type: object
additionalProperties: {type: string}
skills_acquired:
type: array
items: {type: string}
required: [position, company, employment_period, location, industry, key_responsibilities, skills_acquired]
projects:
type: array
items:
type: object
properties:
name: {type: string}
description: {type: string}
link: {type: string, format: uri}
required: [name, description]
achievements:
type: array
items:
type: object
properties:
name: {type: string}
description: {type: string}
required: [name, description]
certifications:
type: array
items: {type: string}
languages:
type: array
items:
type: object
properties:
language: {type: string}
proficiency: {type: string, enum: [Native, Fluent, Intermediate, Beginner]}
required: [language, proficiency]
interests:
type: array
items: {type: string}
availability:
type: object
properties:
notice_period: {type: string}
required: [notice_period]
salary_expectations:
type: object
properties:
salary_range_usd: {type: string}
required: [salary_range_usd]
self_identification:
type: object
properties:
gender: {type: string}
pronouns: {type: string}
veteran: {type: string, enum: [Yes, No]}
disability: {type: string, enum: [Yes, No]}
ethnicity: {type: string}
required: [gender, pronouns, veteran, disability, ethnicity]
legal_authorization:
type: object
properties:
eu_work_authorization: {type: string, enum: [Yes, No]}
us_work_authorization: {type: string, enum: [Yes, No]}
requires_us_visa: {type: string, enum: [Yes, No]}
requires_us_sponsorship: {type: string, enum: [Yes, No]}
requires_eu_visa: {type: string, enum: [Yes, No]}
legally_allowed_to_work_in_eu: {type: string, enum: [Yes, No]}
legally_allowed_to_work_in_us: {type: string, enum: [Yes, No]}
requires_eu_sponsorship: {type: string, enum: [Yes, No]}
required: [eu_work_authorization, us_work_authorization, requires_us_visa, requires_us_sponsorship, requires_eu_visa, legally_allowed_to_work_in_eu, legally_allowed_to_work_in_us, requires_eu_sponsorship]
work_preferences:
type: object
properties:
remote_work: {type: string, enum: [Yes, No]}
in_person_work: {type: string, enum: [Yes, No]}
open_to_relocation: {type: string, enum: [Yes, No]}
willing_to_complete_assessments: {type: string, enum: [Yes, No]}
willing_to_undergo_drug_tests: {type: string, enum: [Yes, No]}
willing_to_undergo_background_checks: {type: string, enum: [Yes, No]}
required: [remote_work, in_person_work, open_to_relocation, willing_to_complete_assessments, willing_to_undergo_drug_tests, willing_to_undergo_background_checks]

View file

@ -31,6 +31,8 @@ locations:
- Country1
- Country2
applyOnceAtCompany: [true/false]
distance: 100
companyBlacklist:
@ -39,4 +41,8 @@ companyBlacklist:
titleBlacklist:
- word1
- word2
- word2
llm_model_type: openai
llm_model: gpt-4o
llm_api_url: https://api.pawan.krd/cosmosrp/v1

View file

@ -1,3 +1,3 @@
email: myemaillinkedin@gmail.com
password: ImpossiblePassowrd10
openai_api_key: sk-11KRr4uuTwpRGfeRTfj1T9BlbkFJjP8QTrswHU1yGruru2FR
llm_api_key: 'sk-11KRr4uuTwpRGfeRTfj1T9BlbkFJjP8QTrswHU1yGruru2FR'

View file

@ -26,10 +26,11 @@ date:
positions:
- Software Tester
locations:
- USA
applyOnceAtCompany: [true/false]
distance: 100
companyBlacklist:
@ -37,3 +38,7 @@ companyBlacklist:
- Crossover
titleBlacklist:
llm_model_type: openai
llm_model: 'gpt-4o'
llm_api_url: https://api.pawan.krd/cosmosrp/v1'

View file

@ -0,0 +1,55 @@
Liam Murphy
Galway, Ireland
Email: liam.murphy@gmail.com | LinkedIn: liam-murphy
GitHub: liam-murphy | Phone: +353 871234567
Education
Bachelor's Degree in Computer Science
National University of Ireland, Galway (GPA: 4/4)
Graduation Year: 2020
Experience
Co-Founder & Software Engineer
CryptoWave Solutions (03/2021 - Present)
Location: Ireland | Industry: Blockchain Technology
Co-founded and led a startup specializing in app and software development with a focus on blockchain technology
Provided blockchain consultations for 10+ companies, enhancing their software capabilities with secure, decentralized solutions
Developed blockchain applications, integrated cutting-edge technology to meet client needs and drive industry innovation
Research Intern
National University of Ireland, Galway (11/2022 - 03/2023)
Location: Galway, Ireland | Industry: IoT Security Research
Conducted in-depth research on IoT security, focusing on binary instrumentation and runtime monitoring
Performed in-depth study of the MQTT protocol and Falco
Developed multiple software components including MQTT packet analysis library, Falco adapter, and RML monitor in Prolog
Authored thesis "Binary Instrumentation for Runtime Monitoring of Internet of Things Systems Using Falco"
Software Engineer
University Hospital Galway (05/2022 - 11/2022)
Location: Galway, Ireland | Industry: Healthcare IT
Integrated and enforced robust security protocols
Developed and maintained a critical software tool for password validation used by over 1,600 employees
Played an integral role in the hospital's cybersecurity team
Projects
JobBot
AI-driven tool to automate and personalize job applications on LinkedIn, gained over 3000 stars on GitHub, improving efficiency and reducing application time
Link: JobBot
mqtt-packet-parser
Developed a Node.js module for parsing MQTT packets, improved parsing efficiency by 40%
Link: mqtt-packet-parser
Achievements
Winner of an Irish public competition - Won first place in a public competition with a perfect score of 70/70, securing a Software Developer position at University Hospital Galway
Galway Merit Scholarship - Awarded annually from 2018 to 2020 in recognition of academic excellence and contribution
GitHub Recognition - Gained over 3000 stars on GitHub with JobBot project
Certifications
C1
Languages
English - Native
Spanish - Professional
Interests
Full-Stack Development, Software Architecture, IoT system design and development, Artificial Intelligence, Cloud Technologies

View file

@ -1,3 +1,3 @@
email: myemaillinkedin@gmail.com
password: ImpossiblePassowrd10
openai_api_key: sk-11KRr4uuTwpRGfeRTfj1T9BlbkFJjP8QTrswHU1yGruru2FR
llm_api_key: 'sk-11KRr4uuTwpRGfeRTfj1T9BlbkFJjP8QTrswHU1yGruru2FR'

19
main.py
View file

@ -101,7 +101,7 @@ class ConfigValidator:
@staticmethod
def validate_secrets(secrets_yaml_path: Path) -> tuple:
secrets = ConfigValidator.validate_yaml_file(secrets_yaml_path)
mandatory_secrets = ['email', 'password', 'openai_api_key']
mandatory_secrets = ['email', 'password']
for secret in mandatory_secrets:
if secret not in secrets:
@ -111,10 +111,7 @@ class ConfigValidator:
raise ConfigError(f"Invalid email format in secrets file {secrets_yaml_path}.")
if not secrets['password']:
raise ConfigError(f"Password cannot be empty in secrets file {secrets_yaml_path}.")
if not secrets['openai_api_key']:
raise ConfigError(f"OpenAI API key cannot be empty in secrets file {secrets_yaml_path}.")
return secrets['email'], str(secrets['password']), secrets['openai_api_key']
return secrets['email'], str(secrets['password']), secrets['llm_api_key']
class FileManager:
@staticmethod
@ -158,14 +155,14 @@ def init_browser() -> webdriver.Chrome:
except Exception as e:
raise RuntimeError(f"Failed to initialize browser: {str(e)}")
def create_and_run_bot(email: str, password: str, parameters: dict, openai_api_key: str):
def create_and_run_bot(email, password, parameters, llm_api_key):
try:
style_manager = StyleManager()
resume_generator = ResumeGenerator()
with open(parameters['uploads']['plainTextResume'], "r") as file:
with open(parameters['uploads']['plainTextResume'], "r", encoding='utf-8') as file:
plain_text_resume = file.read()
resume_object = Resume(plain_text_resume)
resume_generator_manager = FacadeManager(openai_api_key, style_manager, resume_generator, resume_object, Path("data_folder/output"))
resume_generator_manager = FacadeManager(llm_api_key, style_manager, resume_generator, resume_object, Path("data_folder/output"))
os.system('cls' if os.name == 'nt' else 'clear')
resume_generator_manager.choose_style()
os.system('cls' if os.name == 'nt' else 'clear')
@ -175,7 +172,7 @@ def create_and_run_bot(email: str, password: str, parameters: dict, openai_api_k
browser = init_browser()
login_component = LinkedInAuthenticator(browser)
apply_component = LinkedInJobManager(browser)
gpt_answerer_component = GPTAnswerer(openai_api_key)
gpt_answerer_component = GPTAnswerer(parameters, llm_api_key)
bot = LinkedInBotFacade(login_component, apply_component)
bot.set_secrets(email, password)
bot.set_job_application_profile_and_resume(job_application_profile_object, resume_object)
@ -197,12 +194,12 @@ def main(resume: Path = None):
secrets_file, config_file, plain_text_resume_file, output_folder = FileManager.validate_data_folder(data_folder)
parameters = ConfigValidator.validate_config(config_file)
email, password, openai_api_key = ConfigValidator.validate_secrets(secrets_file)
email, password, llm_api_key = ConfigValidator.validate_secrets(secrets_file)
parameters['uploads'] = FileManager.file_paths_to_dict(resume, plain_text_resume_file)
parameters['outputFileDirectory'] = output_folder
create_and_run_bot(email, password, parameters, openai_api_key)
create_and_run_bot(email, password, parameters, llm_api_key)
except ConfigError as ce:
print(f"Configuration error: {str(ce)}")
print("Refer to the configuration guide for troubleshooting: https://github.com/feder-cr/LinkedIn_AIHawk_automatic_job_application/blob/main/readme.md#configuration")

Binary file not shown.

156
resume_yaml_generator.py Normal file
View file

@ -0,0 +1,156 @@
import argparse
import yaml
from openai import OpenAI
import os
from typing import Dict, Any
import re
from jsonschema import validate, ValidationError
from pdfminer.high_level import extract_text
def load_yaml(file_path: str) -> Dict[str, Any]:
with open(file_path, 'r') as file:
return yaml.safe_load(file)
def load_resume_text(file_path: str) -> str:
with open(file_path, 'r') as file:
return file.read()
def get_api_key() -> str:
secrets_path = os.path.join('data_folder', 'secrets.yaml')
if not os.path.exists(secrets_path):
raise FileNotFoundError(f"Secrets file not found at {secrets_path}")
secrets = load_yaml(secrets_path)
api_key = secrets.get('openai_api_key')
if not api_key:
raise ValueError("OpenAI API key not found in secrets.yaml")
return api_key
def generate_yaml_from_resume(resume_text: str, schema: Dict[str, Any], api_key: str) -> str:
client = OpenAI(api_key=api_key)
prompt = f"""
I'm sending you the content of a text-based resume. Your task is to interpret this content and generate a YAML file that conforms to the following schema structure.
The generated YAML should include all required fields and follow the structure defined in the schema.
Pay special attention to the property attributes in the schema. These indicate the expected type and format for each field:
- 'type': Specifies the data type (e.g., string, object, array)
- 'format': Indicates a specific format for certain fields:
- 'date' format should be a valid date (e.g., YYYY-MM-DD)
- 'phone_prefix' format should be a valid country code with a '+' prefix (e.g., +1 for US)
- 'phone' format should be a valid phone number
- 'email' format should be a valid email address
- 'uri' format should be a valid URL
- 'enum': Provides a list of allowed values for a field
Important instructions:
1. Ensure that the YAML structure matches exactly with the provided schema. Use a dictionary structure that mirrors the schema.
2. For all sections, if information is not explicitly provided in the resume, make a best guess based on the context of the resume. This is CRUCIAL for the following fields:
- languages: Infer from the resume content or make an educated guess. Use the 'enum' values for proficiency.
- interests: Deduce from the overall resume or related experiences.
- availability (notice_period): Provide a reasonable estimate (e.g., "2 weeks" or "1 month").
- salary_expectations (salary_range_usd): Estimate based on experience level and industry standards.
- self_identification: Make reasonable assumptions based on the resume context. Use 'enum' values where provided.
- legal_authorization: Provide plausible values based on the resume information. Use 'Yes' or 'No' as per the 'enum' values.
- work_preferences: Infer from job history, skills, and overall resume tone. Use 'Yes' or 'No' as per the 'enum' values.
3. For the fields mentioned in point 2, always provide a value. Do not leave them blank or omit them.
4. For the 'key_responsibilities' field in 'experience_details', format the responsibilities as follows:
responsibility_1: "Description of first responsibility"
responsibility_2: "Description of second responsibility"
responsibility_3: "Description of third responsibility"
responsibility_4: "Description of fourth responsibility"
Continue this pattern for all responsibilities listed.
5. In the 'experience_details' section, ensure that 'position' comes before 'company' in each entry.
6. For the 'skills_acquired' field in 'experience_details', infer relevant skills based on the job responsibilities and industry. Do not leave this field empty.
7. Make reasonable inferences for any missing dates, such as date_of_birth or employment dates, ensuring they follow the 'date' format.
8. For array types (e.g., education_details, experience_details), ensure to include all required fields for each item as specified in the schema.
Resume Text Content:
{resume_text}
YAML Schema:
{yaml.dump(schema, default_flow_style=False)}
Generate the YAML content that matches this schema based on the resume content provided, ensuring all format hints are followed and making educated guesses where necessary. Be sure to include best guesses for ALL fields, even if not explicitly mentioned in the resume.
Enclose your response in <resume_yaml> tags. Only include the YAML content within these tags, without any additional text or code block markers.
"""
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant that generates structured YAML content from resume files, paying close attention to format requirements and schema structure."},
{"role": "user", "content": prompt}
],
temperature=0.5,
)
yaml_content = response.choices[0].message.content.strip()
# Extract YAML content from between the tags
match = re.search(r'<resume_yaml>(.*?)</resume_yaml>', yaml_content, re.DOTALL)
if match:
return match.group(1).strip()
else:
raise ValueError("YAML content not found in the expected format")
def save_yaml(data: str, output_file: str):
with open(output_file, 'w') as file:
file.write(data)
def validate_yaml(yaml_content: str, schema: Dict[str, Any]) -> Dict[str, Any]:
try:
yaml_dict = yaml.safe_load(yaml_content)
validate(instance=yaml_dict, schema=schema)
return {"valid": True, "errors": None}
except ValidationError as e:
return {"valid": False, "errors": str(e)}
def generate_report(validation_result: Dict[str, Any], output_file: str):
report = f"Validation Report for {output_file}\n"
report += "=" * 40 + "\n"
if validation_result["valid"]:
report += "YAML is valid and conforms to the schema.\n"
else:
report += "YAML is not valid. Errors:\n"
report += validation_result["errors"] + "\n"
print(report)
def pdf_to_text(pdf_path: str) -> str:
return extract_text(pdf_path)
def main():
parser = argparse.ArgumentParser(description="Generate a resume YAML file from a PDF or text resume using OpenAI API")
parser.add_argument("--input", required=True, help="Path to the input resume file (PDF or TXT)")
parser.add_argument("--output", default="data_folder/plain_text_resume.yaml", help="Path to the output YAML file")
args = parser.parse_args()
try:
api_key = get_api_key()
schema = load_yaml("assets/resume_schema.yaml")
# Check if input is PDF or TXT
if args.input.lower().endswith('.pdf'):
resume_text = pdf_to_text(args.input)
print(f"PDF resume converted to text successfully.")
else:
resume_text = load_resume_text(args.input)
generated_yaml = generate_yaml_from_resume(resume_text, schema, api_key)
save_yaml(generated_yaml, args.output)
print(f"Resume YAML generated and saved to {args.output}")
validation_result = validate_yaml(generated_yaml, schema)
if validation_result["valid"]:
print("YAML is valid and conforms to the schema.")
else:
print("YAML is not valid. Errors:")
print(validation_result["errors"])
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()

View file

@ -4,6 +4,8 @@ import re
import textwrap
import time
from datetime import datetime
from abc import ABC, abstractmethod
from typing import Dict, List, Union
from pathlib import Path
from typing import Dict, List
@ -21,11 +23,68 @@ from src.utils import logger
load_dotenv()
class AIModel(ABC):
@abstractmethod
def invoke(self, prompt: str) -> str:
pass
class OpenAIModel(AIModel):
def __init__(self, api_key: str, llm_model: str, llm_api_url: str):
from langchain_openai import ChatOpenAI
self.model = ChatOpenAI(model_name=llm_model, openai_api_key=api_key,
temperature=0.4, base_url=llm_api_url)
def invoke(self, prompt: str) -> str:
print("invoke in openai")
response = self.model.invoke(prompt)
return response
class ClaudeModel(AIModel):
def __init__(self, api_key: str, llm_model: str, llm_api_url: str):
from langchain_anthropic import ChatAnthropic
self.model = ChatAnthropic(model=llm_model, api_key=api_key,
temperature=0.4, base_url=llm_api_url)
def invoke(self, prompt: str) -> str:
response = self.model.invoke(prompt)
return response
class OllamaModel(AIModel):
def __init__(self, api_key: str, llm_model: str, llm_api_url: str):
from langchain_ollama import ChatOllama
self.model = ChatOllama(model=llm_model, base_url=llm_api_url)
def invoke(self, prompt: str) -> str:
response = self.model.invoke(prompt)
return response
class AIAdapter:
def __init__(self, config: dict, api_key: str):
self.model = self._create_model(config, api_key)
def _create_model(self, config: dict, api_key: str) -> AIModel:
llm_model_type = config['llm_model_type']
llm_model = config['llm_model']
llm_api_url = config['llm_api_url']
print('Using {0} with {1} from {2}'.format(llm_model_type, llm_model, llm_api_url))
if llm_model_type == "openai":
return OpenAIModel(api_key, llm_model, llm_api_url)
elif llm_model_type == "claude":
return ClaudeModel(api_key, llm_model, llm_api_url)
elif llm_model_type == "ollama":
return OllamaModel(api_key, llm_model, llm_api_url)
else:
raise ValueError(f"Unsupported model type: {model_type}")
def invoke(self, prompt: str) -> str:
return self.model.invoke(prompt)
class LLMLogger:
def __init__(self, llm: ChatOpenAI):
logger.debug("Initializing LLMLogger with LLM: %s", llm)
def __init__(self, llm: Union[OpenAIModel, OllamaModel, ClaudeModel]):
self.llm = llm
logger.debug("LLMLogger successfully initialized with LLM: %s", llm)
@ -129,12 +188,15 @@ class LLMLogger:
class LoggerChatModel:
def __init__(self, llm: ChatOpenAI):
logger.debug("Initializing LoggerChatModel with LLM: %s", llm)
def __init__(self, llm: Union[OpenAIModel, OllamaModel, ClaudeModel]):
self.llm = llm
logger.debug("LoggerChatModel successfully initialized with LLM: %s", llm)
def __call__(self, messages: List[Dict[str, str]]) -> str:
logger.debug("Entering __call__ method with messages: %s", messages)
while True:
try:
@ -185,6 +247,7 @@ class LoggerChatModel:
time.sleep(30)
continue
def parse_llmresult(self, llmresult: AIMessage) -> Dict[str, Dict]:
logger.debug("Parsing LLM result: %s", llmresult)
@ -223,11 +286,10 @@ class LoggerChatModel:
class GPTAnswerer:
def __init__(self, openai_api_key):
self.llm_cheap = LoggerChatModel(
ChatOpenAI(model_name="gpt-4o-mini", openai_api_key=openai_api_key, temperature=0.4)
)
logger.debug("GPTAnswerer initialized with API key")
def __init__(self, config, llm_api_key):
self.ai_adapter = AIAdapter(config, llm_api_key)
self.llm_cheap = LoggerChatModel(self.ai_adapter)
@property
def job_description(self):
@ -391,8 +453,13 @@ class GPTAnswerer:
prompt = ChatPromptTemplate.from_template(section_prompt)
chain = prompt | self.llm_cheap | StrOutputParser()
output = chain.invoke({"question": question})
logger.debug("Section determined from question: %s", output)
section_name = output.lower().replace(" ", "_")
match = re.search(r"(Personal information|Self Identification|Legal Authorization|Work Preferences|Education Details|Experience Details|Projects|Availability|Salary Expectations|Certifications|Languages|Interests|Cover letter)", output, re.IGNORECASE)
if not match:
raise ValueError("Could not extract section name from the response.")
section_name = match.group(1).lower().replace(" ", "_")
if section_name == "cover_letter":
chain = chains.get(section_name)
output = chain.invoke({"resume": self.resume, "job_description": self.job_description})

View file

@ -39,6 +39,9 @@ class LinkedInAuthenticator:
def handle_login(self):
logger.info("Navigating to the LinkedIn login page...")
self.driver.get("https://www.linkedin.com/login")
if 'feed' in self.driver.current_url:
print("User is already logged in.")
return
try:
self.enter_credentials()
self.submit_login_form()

View file

@ -34,8 +34,10 @@ class LinkedInEasyApplier:
self.gpt_answerer = gpt_answerer
self.resume_generator_manager = resume_generator_manager
self.all_data = self._load_questions_from_json()
logger.debug("LinkedInEasyApplier initialized successfully")
def _load_questions_from_json(self) -> List[dict]:
output_file = 'answers.json'
logger.debug("Loading questions from JSON file: %s", output_file)
@ -58,6 +60,7 @@ class LinkedInEasyApplier:
logger.error("Error loading questions data from JSON file: %s", tb_str)
raise Exception(f"Error loading questions data from JSON file: \nTraceback:\n{tb_str}")
def check_for_premium_redirect(self, job: Any, max_attempts=3):
"""Проверяет, был ли выполнен редирект на страницу LinkedIn Premium.
В случае редиректа возвращает пользователя на исходную страницу вакансии."""
@ -77,6 +80,7 @@ class LinkedInEasyApplier:
raise Exception(
f"Redirected to LinkedIn Premium page and failed to return after {max_attempts} attempts. Job application aborted.")
def job_apply(self, job: Any):
logger.debug("Starting job application for job: %s", job)
@ -205,6 +209,7 @@ class LinkedInEasyApplier:
logger.error("No clickable 'Easy Apply' button found after 2 attempts. Page source:\n%s", page_source)
raise Exception("No clickable 'Easy Apply' button found")
def _get_job_description(self) -> str:
logger.debug("Getting job description")
try:
@ -596,6 +601,7 @@ class LinkedInEasyApplier:
for item in self.all_data:
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'radio':
existing_answer = item
break
if existing_answer:
self._select_radio(radios, existing_answer['answer'])
@ -626,6 +632,7 @@ class LinkedInEasyApplier:
for item in self.all_data:
logger.debug(
f"Comparing sanitized stored question: '{self._sanitize_text(item['question'])}' and type: '{item.get('type')}' with current question: '{self._sanitize_text(question_text)}' and type: '{question_type}'")
@ -652,6 +659,7 @@ class LinkedInEasyApplier:
answer = self.gpt_answerer.answer_question_textual_wide_range(question_text)
logger.debug(f"Generated textual answer: {answer}")
self._save_questions_to_json({'type': question_type, 'question': question_text, 'answer': answer})
self._enter_text(text_field, answer)
logger.debug("Entered new answer into the textbox and saved it to JSON.")
@ -677,12 +685,14 @@ class LinkedInEasyApplier:
for item in self.all_data:
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'date':
existing_answer = item
break
if existing_answer:
self._enter_text(date_field, existing_answer['answer'])
logger.debug("Entered existing date answer")
return True
self._save_questions_to_json({'type': 'date', 'question': question_text, 'answer': answer_text})
self._enter_text(date_field, answer_text)
logger.debug("Entered new date answer")
@ -701,6 +711,7 @@ class LinkedInEasyApplier:
dropdown = dropdowns[0]
select = Select(dropdown)
options = [option.text for option in select.options]
logger.debug(f"Dropdown options found: {options}")
current_selection = select.first_selected_option.text
@ -720,6 +731,7 @@ class LinkedInEasyApplier:
return True
logger.debug(f"No existing answer found, querying model for: {question_text}")
answer = self.gpt_answerer.answer_question_from_options(question_text, options)
self._save_questions_to_json({'type': 'dropdown', 'question': question_text, 'answer': answer})
self._select_dropdown_option(dropdown, answer)

View file

@ -49,6 +49,7 @@ class LinkedInJobManager:
self.title_blacklist = parameters.get('titleBlacklist', []) or []
self.positions = parameters.get('positions', [])
self.locations = parameters.get('locations', [])
self.apply_once_at_company = parameters.get('applyOnceAtCompany', False)
self.base_search_url = self.get_base_search_url(parameters)
self.seen_jobs = []
resume_path = parameters.get('uploads', {}).get('resume', None)
@ -200,6 +201,12 @@ class LinkedInJobManager:
logger.debug("Job blacklisted: %s at %s", job.title, job.company)
self.write_to_file(job, "skipped")
continue
if self.is_already_applied_to_job(job.title, job.company, job.link):
self.write_to_file(job, "skipped")
continue
if self.is_already_applied_to_company(job.company):
self.write_to_file(job, "skipped")
continue
try:
if job.apply_method not in {"Continue", "Applied", "Apply"}:
self.easy_applier_component.job_apply(job)
@ -303,6 +310,35 @@ class LinkedInJobManager:
title_blacklisted = any(word in job_title_words for word in self.title_blacklist)
company_blacklisted = company.strip().lower() in (word.strip().lower() for word in self.company_blacklist)
link_seen = link in self.seen_jobs
is_blacklisted = title_blacklisted or company_blacklisted or link_seen
logger.debug("Job blacklisted status: %s", is_blacklisted)
return is_blacklisted
return title_blacklisted or company_blacklisted or link_seen
def is_already_applied_to_job(self, job_title, company, link):
link_seen = link in self.seen_jobs
if link_seen:
utils.printyellow(f"Already applied to job: {job_title} at {company}, skipping...")
return link_seen
def is_already_applied_to_company(self, company):
if not self.apply_once_at_company:
return False
output_files = ["success.json"]
for file_name in output_files:
file_path = self.output_file_directory / file_name
if file_path.exists():
with open(file_path, 'r', encoding='utf-8') as f:
try:
existing_data = json.load(f)
for applied_job in existing_data:
if applied_job['company'].strip().lower() == company.strip().lower():
utils.printyellow(f"Already applied at {company} (once per company policy), skipping...")
return True
except json.JSONDecodeError:
continue
return False

View file

@ -1,9 +1,16 @@
from typing import Dict, List
from linkedin_api import Linkedin
from typing import Optional, Union, Literal
from urllib.parse import urlencode
from urllib.parse import quote, urlencode
import logging
import json
# set log to all debug
logging.basicConfig(level=logging.INFO)
class LinkedInEvolvedAPI(Linkedin):
already_applied_jobs: List[str] = []
def __init__(self, username, password):
super().__init__(username, password)
@ -40,7 +47,7 @@ class LinkedInEvolvedAPI(Linkedin):
industries: Optional[List[str]] = None,
location_name: Optional[str] = None,
remote: Optional[List[Union[Literal["1"], Literal["2"], Literal["3"]]]] = None,
listed_at=24 * 60 * 60,
listed_at: None | int = None,
distance: Optional[int] = None,
easy_apply: Optional[bool] = True,
limit=-1,
@ -65,8 +72,8 @@ class LinkedInEvolvedAPI(Linkedin):
:type location_name: str, optional
:param remote: Filter for remote jobs, onsite or hybrid. onsite:"1", remote:"2", hybrid:"3"
:type remote: list, optional
:param listed_at: maximum number of seconds passed since job posting. 86400 will filter job postings posted in last 24 hours.
:type listed_at: int/str, optional. Default value is equal to 24 hours.
:param listed_at: maximum number of seconds passed since job posting. 86400 will filter job postings posted in last 24 hours, default is None
:type listed_at: int or none, if none, no filter applied, otherwise, filter applied in seconds
:param distance: maximum distance from location in miles
:type distance: int/str, optional. If not specified, None or 0, the default value of 25 miles applied.
:param easy_apply: filter for jobs that are easy to apply to
@ -106,9 +113,10 @@ class LinkedInEvolvedAPI(Linkedin):
if remote:
query["selectedFilters"]["workplaceType"] = f"List({','.join(remote)})"
if easy_apply:
query["selectedFilters"]["easyApply"] = "List(true)"
query["selectedFilters"]["applyWithLinkedin"] = "List(true)"
query["selectedFilters"]["timePostedRange"] = f"List(r{listed_at})"
if listed_at:
query["selectedFilters"]["timePostedRange"] = f"List(r{listed_at})"
query["spellCorrectionEnabled"] = "true"
query_string = (
@ -137,7 +145,6 @@ class LinkedInEvolvedAPI(Linkedin):
headers={"accept": "application/vnd.linkedin.normalized+json+2.1"},
)
data = res.json()
elements = data.get("included", [])
new_data = []
for e in elements:
@ -160,9 +167,219 @@ class LinkedInEvolvedAPI(Linkedin):
self.logger.debug(f"results grew to {len(results)}")
return results
def get_fields_for_easy_apply(self,job_id: str) -> List[Dict]:
"""Get fields needed for easy apply jobs.
:param job_id: Job ID
:type job_id: str
:return: Fields
:rtype: dict
"""
cookies = self.client.session.cookies.get_dict()
cookie_str = "; ".join([f"{k}={v}" for k, v in cookies.items()])
headers: Dict[str, str] = self._headers()
headers["Accept"] = "application/vnd.linkedin.normalized+json+2.1"
headers["csrf-token"] = cookies["JSESSIONID"].replace('"', "")
headers["Cookie"] = cookie_str
headers["Connection"] = "keep-alive"
default_params = {
"decorationId": "com.linkedin.voyager.dash.deco.jobs.OnsiteApplyApplication-67",
"jobPostingUrn": f"urn:li:fsd_jobPosting:{job_id}",
"q": "jobPosting",
}
default_params = urlencode(default_params)
res = self._fetch(
f"/voyagerJobsDashOnsiteApplyApplication?{default_params}",
headers=headers,
cookies=cookies,
)
match res.status_code:
case 200:
pass
case 409:
self.logger.error("Failed to fetch fields for easy apply job because already applied to this job!")
return []
case _:
self.logger.error("Failed to fetch fields for easy apply job")
return []
try:
data = res.json()
except ValueError:
self.logger.error("Failed to parse JSON response")
return []
form_components = []
for item in data.get("included", []):
if 'formComponent' in item:
urn = item['urn']
try:
title = item['title']['text']
except TypeError:
title = urn
form_component_type = list(item['formComponent'].keys())[0]
form_component_details = item['formComponent'][form_component_type]
component_info = {
'title': title,
'urn': urn,
'formComponentType': form_component_type,
}
if 'textSelectableOptions' in form_component_details:
options = [
opt['optionText']['text'] for opt in form_component_details['textSelectableOptions']
]
component_info['selectableOptions'] = options
elif 'selectableOptions' in form_component_details:
options = [
opt['textSelectableOption']['optionText']['text']
for opt in form_component_details['selectableOptions']
]
component_info['selectableOptions'] = options
form_components.append(component_info)
return form_components
def apply_to_job(self,job_id: str, fields: dict, followCompany: bool = True) -> bool:
return False
# ToDo: Implement apply to job parser first
# How need to be implemented:
# 1. Get fields for easy apply job from the previous method (get_fields_for_easy_apply)
# 2. Fill the fields with the data adding a response parameter in the specific field in the dict object, for example:
# {'title': 'Quanti anni di esperienza di lavoro hai con Router?', 'urn': 'urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4013860791,9478711764,numeric)', 'formComponentType': 'singleLineTextFormComponent'}
# Became:
# {'title': 'Quanti anni di esperienza di lavoro hai con Router?', 'urn': 'urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4013860791,9478711764,numeric)', 'formComponentType': 'singleLineTextFormComponent', 'response': '5'}
# To fill, you can temporary use input() function to get the data from the user manually for testing purposes (for the further implementation, the question will be asked to AI implementation and automatically filled)
# Build a working payload.
# EXAMPLE OF WORKING PAYLOAD
# 4005350454 is job_id, so need to be replaced with the job_id
#{
# "followCompany": true,
# "responses": [
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278561,multipleChoice)",
# "formElementInputValues": [
# {
# "entityInputValue": {
# "inputEntityName": "email@gmail.com"
# }
# }
# ]
# },
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278545,phoneNumber~country)",
# "formElementInputValues": [
# {
# "entityInputValue": {
# "inputEntityName": "Italy (+39)",
# "inputEntityUrn": "urn:li:country:it"
# }
# }
# ]
# },
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278545,phoneNumber~nationalNumber)",
# "formElementInputValues": [
# {
# "textInputValue": "3333333"
# }
# ]
# },
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278529,multipleChoice)",
# "formElementInputValues": [
# {
# "entityInputValue": {
# "inputEntityName": "Native or bilingual"
# }
# }
# ]
# },
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278537,numeric)",
# "formElementInputValues": [
# {
# "textInputValue": "0"
# }
# ]
# },
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3498546713,multipleChoice)",
# "formElementInputValues": [
# {
# "entityInputValue": {
# "inputEntityName": "No"
# }
# }
# ]
# },
# {
# "formElementUrn": "urn:li:fsd_formElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278521,multipleChoice)",
# "formElementInputValues": [
# {
# "entityInputValue": {
# "inputEntityName": "No"
# }
# }
# ]
# }
# ],
# "referenceId": "",
# "trackingCode": "d_flagship3_search_srp_jobs",
# "fileUploadResponses": [
# {
# "inputUrn": "urn:li:fsd_resume:/##todo##",
# "formElementUrn": "urn:li:fsu_jobApplicationFileUploadFormElement:urn:li:jobs_applyformcommon_easyApplyFormElement:(4005350454,3497278553,document)"
# }
# ],
# "trackingId": ""
#}
# Push the commit to the repository and create a pull request to the v3 branch.
def set_job_as_applied(self, job_id: str) -> None:
self.already_applied_jobs.append(job_id)
## EXAMPLE USAGE
if __name__ == "__main__":
api: LinkedInEvolvedAPI = LinkedInEvolvedAPI(username="", password="")
jobs = api.search_jobs(keywords="Frontend Developer", location_name="Italia", limit=100, easy_apply=True, offset=1, listed_at=None)
for job in jobs:
job_id: str = job["job_id"]
print(f"Job ID: {job_id}")
continue
if job_id in api.already_applied_jobs:
logging.info(f"Already applied to job {job_id}, skipping it")
continue
fields = api.get_fields_for_easy_apply(job_id)
for field in fields:
print(field)
break