Last active
June 24, 2024 22:23
-
-
Save eeskildsen/8737d44e1f908c7e3f2936e746b8a36c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 1. Go to the "Review Proposals" tab of your job | |
// 2. Open DevTools (F12) | |
// 3. Paste this script | |
// 4. Once it's extracted the data from 100% of your proposals, it will | |
// output an array of their details into the DevTools console. Right- | |
// click the array and click `Copy object`. This is JSON of all your | |
// proposals. | |
// You can use any tool that works with JSON to manipulate the data. | |
// For example, in PowerShell: | |
// | |
// Get-Clipboard | ConvertFrom-Json -Depth 99 | Export-ToCsv 'my.csv' | |
const jobId = '1803447321894287550'; | |
async function fetchWithPagination(url, queryStringParams) { | |
const result = []; | |
let cursor = 'init'; | |
const urlWithQueryString = new URL(url); | |
const requestOptions = { | |
method: 'GET' | |
}; | |
const urlSearchParams = new URLSearchParams(queryStringParams); | |
let hasMore = false; | |
urlSearchParams.append('cursor', cursor); | |
do { | |
urlWithQueryString.search = urlSearchParams.toString(); | |
console.log(urlWithQueryString.toString()); | |
const response = await fetch(urlWithQueryString, requestOptions); | |
const data = await response.json(); | |
result.push(data); | |
await new Promise(resolve => setTimeout(resolve, 3000)); | |
cursor = data.scrolling.following || null; | |
urlSearchParams.set('cursor', cursor); | |
hasMore = data.scrolling.hasMore === true && cursor !== null; | |
} while (hasMore); | |
return result; | |
} | |
// Load all applications | |
const sponsoredApplications = await fetchWithPagination(`https://www.upwork.com/ab/ats-aas/api/applicants/${jobId}/search`, {filter: 'sponsored'}); | |
const allApplicationsWithoutSponsored = await fetchWithPagination(`https://www.upwork.com/ab/ats-aas/api/applicants/${jobId}/search`, {filter: 'applicants_all_without_sponsored'}); | |
const allApplications = [...sponsoredApplications.flatMap(x => x.applications), ...allApplicationsWithoutSponsored.flatMap(x => x.applications)]; | |
console.log(allApplications); | |
console.log('Done'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment