Skip to content

Instantly share code, notes, and snippets.

@guibeira
Last active February 1, 2023 01:35
Show Gist options
  • Save guibeira/84d6da8a13fe6dae2fdf493ff46fe16d to your computer and use it in GitHub Desktop.
Save guibeira/84d6da8a13fe6dae2fdf493ff46fe16d to your computer and use it in GitHub Desktop.
small script to search content in job description
const timer = ms => new Promise(res => setTimeout(res, ms))
async function search(content) {
// // adjust the zoom level
// get list of jobs
let has_jobs = true
while (has_jobs) {
let scrolling = 0
const pg_button = document.getElementsByClassName("artdeco-pagination__indicator selected")
const next = pg_button[0].nextElementSibling
const jobs = document.getElementsByClassName("job-card-list__entity-lockup")
const scroll = document.getElementsByClassName("jobs-search-results-list")[0]
// loop through jobs
for (const element of jobs) {
const job = element;
console.log("Checking job: ", job.innerText)
// click on job
job.getElementsByClassName("job-card-list__title")[0].click()
// check if job is a match
const detail = document.getElementsByClassName("jobs-description-content__text--stretch")[0]
for (const element of content) {
const word = element;
if (detail.innerText.includes(word.capitalize()) || detail.innerText.includes(word.toLowerCase()) ) {
// save job
console.log("Saving job: ", job.innerText)
document.getElementsByClassName("jobs-save-button")[0].click();
}
}
scrolling += 100
scroll.scroll(0,scrolling)
await timer(2000);
}
// go to the next page
if (next) {
next.getElementsByTagName("button")[0].click()
}else{
has_jobs = false
alert("No more jobs to check!")
}
}
}
@guibeira
Copy link
Author

Enter the job search page:
https://www.linkedin.com/jobs/search/
do your pre-filter, then copy the content above, open your console in your browser and past the script, then call it with the keywords you want, e.g.

await search(["django", "fast-api"])

@guibeira
Copy link
Author

This script was moved to this repository
https://github.com/GuilhermeVBeira/linkedin-utils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment