Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linkedin_scraper/models/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Person(BaseModel):
"""
linkedin_url: str
name: Optional[str] = None
headline:Optional[str] = None
location: Optional[str] = None
about: Optional[str] = None
open_to_work: bool = False
Expand Down
13 changes: 13 additions & 0 deletions linkedin_scraper/scrapers/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ async def scrape(self, linkedin_url: str) -> Person:
# Get name and location
name, location = await self._get_name_and_location()
await self.callback.on_progress(f"Got name: {name}", 20)

# Get headline
headline = await self._get_headline()
await self.callback.on_progress(f"Got headline: {headline}", 25)

# Check open to work
open_to_work = await self._check_open_to_work()
Expand All @@ -82,6 +86,7 @@ async def scrape(self, linkedin_url: str) -> Person:
linkedin_url=linkedin_url,
name=name,
location=location,
headline=headline,
about=about,
open_to_work=open_to_work,
experiences=experiences,
Expand All @@ -107,6 +112,14 @@ async def _get_name_and_location(self) -> tuple[str, Optional[str]]:
logger.warning(f"Error getting name/location: {e}")
return "Unknown", None

async def _get_headline(self) -> Optional[str]:
"""Extract headline from profile."""
try:
return await self.safe_extract_text('div.text-body-medium.break-words')
except Exception as e:
logger.warning(f"Error getting headline: {e}")
return None

async def _check_open_to_work(self) -> bool:
"""Check if profile has open to work badge."""
try:
Expand Down