Skip to content

Commit

Permalink
crawler to extract apply button links
Browse files Browse the repository at this point in the history
  • Loading branch information
Intina47 committed Apr 17, 2024
1 parent c51ffe7 commit dfcae1a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
31 changes: 31 additions & 0 deletions crawler/extractor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const puppeteer = require('puppeteer');

async function getApplyLink(jobUrl) {
const browser = await puppeteer.launch();
const page = await browser.newPage();

// Navigate to the job posting URL
await page.goto(jobUrl);

// Find the "Apply" button
const applyButton = await page.$('.jobs-apply-button');

// Click the button to trigger the JavaScript event
await applyButton.click();

// Wait for navigation to complete
await page.waitForNavigation();

// Get the URL after the click event
const applyLink = page.url();

await browser.close();

return applyLink;
}

// Example usage
const jobUrl = 'https://www.linkedin.com/jobs/view/3871588853/?alternateChannel=search&refId=idY2xTvEOPXzQEF3U0zfXQ%3D%3D&trackingId=4n%2BzVl9ay8iloXgUBuuEJw%3D%3D';
getApplyLink(jobUrl)
.then(applyLink => console.log("Job Application Link:", applyLink))
.catch(error => console.error("Error:", error));
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ idna==3.6
multidict==6.0.5
typing_extensions==4.10.0
yarl==1.9.4
python-jobspy==1.1.51


0 comments on commit dfcae1a

Please sign in to comment.