Last active
January 14, 2022 18:29
-
-
Save nobesnickr/5b7ae49b5c16beca4109c53e23f6f24c to your computer and use it in GitHub Desktop.
Unsave "Saved Jobs" on LinkedIn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Navigate to https://www.linkedin.com/my-items/saved-jobs/ | |
// Open the browser console, paste the code below into it, press enter to execute the code, then reload the page | |
var fetchJobCount = function(){ | |
let xRs = $x('//a[@data-control-name="myitems_all_savedjobs"]/div[2]'); | |
jc = parseInt(xRs[0].innerText); | |
if ( isNaN(jc) ) { alert('Could not determine "My Jobs" count. Ensure you are running from the "My Jobs" page (url below) \n\nhttps://www.linkedin.com/my-items/saved-jobs/') }; | |
console.log('Total Job Count: ' + jc); | |
return jc; | |
} | |
var fetchPageCount = function(){ | |
length = $x("//ul[contains(@class, 'artdeco-pagination__pages') and contains(@class, 'artdeco-pagination__pages--number')]/li").length; | |
count = parseInt(length); | |
console.log('Page Count: ' + count); | |
return count; | |
} | |
var fetchJobCountOnPage = function(){ | |
length = $x('//span[text() = "Unsave"]/parent::div').length; | |
count = parseInt(length); | |
console.log('Current Page Job Count: ' + count); | |
return count; | |
} | |
let jobCountTotal = fetchJobCount() | |
let pageCount = fetchPageCount() | |
let jobCountPage = fetchJobCountOnPage() | |
var breaker = 3 | |
var i = 1 | |
while(jobCountTotal > 0 && i < breaker ){ | |
console.log('While Loop Run Start - Iteration #' + i) | |
$x('//span[text() = "Unsave"]/parent::div').forEach(function(e){ e.click() }); | |
i++ | |
jobCountTotal = fetchJobCount() | |
pageCount = fetchPageCount() | |
jobCountPage = fetchJobCountOnPage() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment