import requests
import json
import time
extract_rules = {
"jobs": {
"selector": ".job-card",
"type": "obj",
"multiple": True,
"children": {
"title": {"selector": "h2, h3", "type": "text"},
"company": {"selector": ".company-name", "type": "text"},
"location": {"selector": ".location", "type": "text"},
"salary": {"selector": ".salary", "type": "text"},
"url": {"selector": "a", "type": "link"}
}
},
"next_page": {"selector": "a[rel='next']", "type": "link"}
}
def scrape_jobs(search_url):
response = requests.post("https://api.ujeebu.com/scrape",
headers={
"ApiKey": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"url": search_url,
"js": True,
"wait_for": ".job-card",
"extract_rules": extract_rules
})
return response.json()["result"]
# Search for Python developer jobs
data = scrape_jobs("https://example-jobboard.com/search?q=python+developer")
print(f"Found {len(data['jobs'])} jobs")
for job in data['jobs'][:5]:
print(f"\n{job['title']}")
print(f" Company: {job['company']}")
print(f" Location: {job['location']}")
print(f" Salary: {job.get('salary', 'Not listed')}")
const axios = require('axios');
// Generic extract rules - adapt selectors to your target job board
const extractRules = {
jobs: {
selector: '.job-card',
type: 'obj',
multiple: true,
children: {
title: { selector: 'h2, h3, .job-title', type: 'text' },
company: { selector: '.company-name', type: 'text' },
location: { selector: '.location', type: 'text' },
salary: { selector: '.salary', type: 'text' },
url: { selector: 'a', type: 'link' }
}
},
next_page: { selector: "a[rel='next']", type: 'link' }
};
async function scrapeJobs(searchUrl) {
const response = await axios.post('https://api.ujeebu.com/scrape', {
url: searchUrl,
js: true,
wait_for: '.job-card',
extract_rules: extractRules
}, {
headers: {
'ApiKey': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
return response.data.result;
}
// Scrape developer jobs
const data = await scrapeJobs('https://example-jobboard.com/search?q=developer');
console.log(`Found ${data.jobs.length} jobs`);
data.jobs.slice(0, 5).forEach(job => {
console.log(`${job.title} at ${job.company}`);
console.log(` Salary: ${job.salary || 'Not listed'}`);
});