Fix get_base_search_url to respect user's experience level preferences

- Iterate through 'experienceLevel' dictionary
- Include only levels set to True
- Map indexes to LinkedIn's experience level values (1-6)
This commit is contained in:
Drew Haile 2024-08-15 03:06:37 -04:00
parent 21facf1a98
commit a300ca64ad

View File

@ -176,7 +176,7 @@ class LinkedInJobManager:
url_parts = []
if parameters['remote']:
url_parts.append("f_CF=f_WRA")
experience_levels = [str(i+1) for i, v in enumerate(parameters.get('experienceLevel', [])) if v]
experience_levels = [str(i+1) for i, (level, v) in enumerate(parameters.get('experienceLevel', {}).items()) if v]
if experience_levels:
url_parts.append(f"f_E={','.join(experience_levels)}")
url_parts.append(f"distance={parameters['distance']}")