Search for jobs on LinkedIn. Args: keywords: Job search keywords (e.g., "software engineer") location: Job location (e.g., "San Francisco, CA") limit: Maximum number of job URLs to return Returns: List of
(
self,
keywords: Optional[str] = None,
location: Optional[str] = None,
limit: int = 25
)
| 39 | super().__init__(page, callback or SilentCallback()) |
| 40 | |
| 41 | async def search( |
| 42 | self, |
| 43 | keywords: Optional[str] = None, |
| 44 | location: Optional[str] = None, |
| 45 | limit: int = 25 |
| 46 | ) -> List[str]: |
| 47 | """ |
| 48 | Search for jobs on LinkedIn. |
| 49 | |
| 50 | Args: |
| 51 | keywords: Job search keywords (e.g., "software engineer") |
| 52 | location: Job location (e.g., "San Francisco, CA") |
| 53 | limit: Maximum number of job URLs to return |
| 54 | |
| 55 | Returns: |
| 56 | List of job posting URLs |
| 57 | """ |
| 58 | logger.info(f"Starting job search: keywords='{keywords}', location='{location}'") |
| 59 | |
| 60 | search_url = self._build_search_url(keywords, location) |
| 61 | await self.callback.on_start("JobSearch", search_url) |
| 62 | |
| 63 | await self.navigate_and_wait(search_url) |
| 64 | await self.callback.on_progress("Navigated to search results", 20) |
| 65 | |
| 66 | try: |
| 67 | await self.page.wait_for_selector('a[href*="/jobs/view/"]', timeout=10000) |
| 68 | except: |
| 69 | logger.warning("No job listings found on page") |
| 70 | return [] |
| 71 | |
| 72 | await self.wait_and_focus(1) |
| 73 | await self.scroll_page_to_bottom(pause_time=1, max_scrolls=3) |
| 74 | await self.callback.on_progress("Loaded job listings", 50) |
| 75 | |
| 76 | job_urls = await self._extract_job_urls(limit) |
| 77 | await self.callback.on_progress(f"Found {len(job_urls)} job URLs", 90) |
| 78 | |
| 79 | await self.callback.on_progress("Search complete", 100) |
| 80 | await self.callback.on_complete("JobSearch", job_urls) |
| 81 | |
| 82 | logger.info(f"Job search complete: found {len(job_urls)} jobs") |
| 83 | return job_urls |
| 84 | |
| 85 | def _build_search_url( |
| 86 | self, |