mirror of
https://github.com/Bunsly/JobSpy.git
synced 2026-03-05 03:54:31 -08:00
feat: add ZipRecruiterScraper
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from api.core.scrapers.indeed import IndeedScraper
|
||||
from api.core.scrapers.ziprecruiter import ZipRecruiterScraper
|
||||
from api.core.scrapers import ScraperInput
|
||||
from api.core.jobs import JobResponse
|
||||
|
||||
@@ -8,9 +9,21 @@ router = APIRouter(prefix="/jobs")
|
||||
|
||||
|
||||
@router.get("/")
|
||||
async def scrape_jobs(search_term: str, location: str, page: int = None):
|
||||
scraper = IndeedScraper()
|
||||
async def scrape_jobs(
|
||||
site_type: str, search_term: str, location: str, page: int = None
|
||||
):
|
||||
job_response = {"message": "site type not found"}
|
||||
if site_type == "indeed":
|
||||
indeed_scraper = IndeedScraper()
|
||||
scraper_input = ScraperInput(
|
||||
search_term=search_term, location=location, page=page
|
||||
)
|
||||
job_response = indeed_scraper.scrape(scraper_input)
|
||||
elif site_type == "zip":
|
||||
ziprecruiter_scraper = ZipRecruiterScraper()
|
||||
scraper_input = ScraperInput(
|
||||
search_term=search_term, location=location, page=page
|
||||
)
|
||||
job_response = ziprecruiter_scraper.scrape(scraper_input)
|
||||
|
||||
scraper_input = ScraperInput(search_term=search_term, location=location, page=page)
|
||||
job_response = scraper.scrape(scraper_input)
|
||||
return job_response
|
||||
|
||||
Reference in New Issue
Block a user