OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

AttributeError: 'NoneType' object has no attribute 'get_text' when webscraping [closed]

  • Thread starter Thread starter Lumko Mtengwane
  • Start date Start date
L

Lumko Mtengwane

Guest
this is the section producing the error code:

Code:
 jobs_c1=soup.find_all("div", class_="job-result-title")
for jobs_c1 in jobs_c1:
    title=jobs_c1.find("h2", class_="href").get_text.strip()
    recruiter_name=jobs_c1.find("h3", class_="href").get_text.strip() 

jobs_c2=soup.find_all("div", class_="job-result-overview cjun-serp")
for jobs_c2 in jobs_c2:
    salary=jobs_c2.find("ul", class_="salary").get_text.strip() 
    position=jobs_c2.find("ul", class_="position").get_text.strip()
    location=jobs_c2.find("ul", class_="location").get_text.strip()
    date_posted=jobs_c2.find("ul", class_="updated-time").get_text.strip()

print(f"Job Title: {title}")
print(f"Recruiter name: {recruiter_name}")
print(f"Salary: {salary}")
print(f"Position: {position}")
print(f"Location: {location}")
print(f"Date Posted: {date_posted}")

job_title=input(" Enter the job you are looking for: ") job_details(job_title)

I'm trying to webscape from https://www.careerjunction.co.za/ and create a code that will allow the user to serch for a job title and it displays the job title and its elements
<p>this is the section producing the error code:</p>
<pre><code> jobs_c1=soup.find_all("div", class_="job-result-title")
for jobs_c1 in jobs_c1:
title=jobs_c1.find("h2", class_="href").get_text.strip()
recruiter_name=jobs_c1.find("h3", class_="href").get_text.strip()

jobs_c2=soup.find_all("div", class_="job-result-overview cjun-serp")
for jobs_c2 in jobs_c2:
salary=jobs_c2.find("ul", class_="salary").get_text.strip()
position=jobs_c2.find("ul", class_="position").get_text.strip()
location=jobs_c2.find("ul", class_="location").get_text.strip()
date_posted=jobs_c2.find("ul", class_="updated-time").get_text.strip()

print(f"Job Title: {title}")
print(f"Recruiter name: {recruiter_name}")
print(f"Salary: {salary}")
print(f"Position: {position}")
print(f"Location: {location}")
print(f"Date Posted: {date_posted}")
</code></pre>
<p>job_title=input(" Enter the job you are looking for: ")
job_details(job_title)</p>
<p>I'm trying to webscape from <a href="https://www.careerjunction.co.za/" rel="nofollow noreferrer">https://www.careerjunction.co.za/</a> and create a code that will allow the user to serch for a job title and it displays the job title and its elements</p>
 
Top