File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,12 +164,15 @@ def _process_job(
164164 date_posted = self ._parse_date (job .get ("footerPlaceholderLabel" ), job .get ("createdDate" ))
165165
166166 job_url = f"https://www.naukri.com{ job .get ('jdURL' , f'/job/{ job_id } ' )} "
167- description = job .get ("jobDescription" ) if full_descr else None
167+ raw_description = job .get ("jobDescription" ) if full_descr else None
168+
169+ job_type = parse_job_type (raw_description ) if raw_description else None
170+ company_industry = parse_company_industry (raw_description ) if raw_description else None
171+
172+ description = raw_description
168173 if description and self .scraper_input .description_format == DescriptionFormat .MARKDOWN :
169174 description = markdown_converter (description )
170175
171- job_type = parse_job_type (description ) if description else None
172- company_industry = parse_company_industry (description ) if description else None
173176 is_remote = is_job_remote (title , description or "" , location )
174177 company_logo = job .get ("logoPathV3" ) or job .get ("logoPath" )
175178
Original file line number Diff line number Diff line change 55from jobspy .util import get_enum_from_job_type
66
77
8- def parse_job_type (soup : BeautifulSoup ) -> list [JobType ] | None :
8+ def parse_job_type (soup : BeautifulSoup | str ) -> list [JobType ] | None :
99 """
1010 Gets the job type from the job page
1111 """
12+ if isinstance (soup , str ):
13+ soup = BeautifulSoup (soup , "html.parser" )
1214 job_type_tag = soup .find ("span" , class_ = "job-type" )
1315 if job_type_tag :
1416 job_type_str = job_type_tag .get_text (strip = True ).lower ().replace ("-" , "" )
1517 return [get_enum_from_job_type (job_type_str )] if job_type_str else None
1618 return None
1719
1820
19- def parse_company_industry (soup : BeautifulSoup ) -> str | None :
21+ def parse_company_industry (soup : BeautifulSoup | str ) -> str | None :
2022 """
2123 Gets the company industry from the job page
2224 """
25+ if isinstance (soup , str ):
26+ soup = BeautifulSoup (soup , "html.parser" )
2327 industry_tag = soup .find ("span" , class_ = "industry" )
2428 return industry_tag .get_text (strip = True ) if industry_tag else None
2529
You can’t perform that action at this time.
0 commit comments