w3resource

Python Projects: Fetch job title and location from Indeed website

Python Web Project-10 with Solution

Create a Python project to fetch job title and location from indeed website.

Sample Output:

Job title and location from indeed website:

Job  1 is Mobile App Development Internship at CDSpace Robotics Private Limited
Job  2 is Mobile App Development Internship at Ubincore Technologies
Job  3 is Mobile App Development Internship at RealIQ
Job  4 is Android Mobile App Development at Claysol Media Labs
Job  5 is Mobile App Developer at Diginnovators Solutions Private Limited
Job  6 is Mobile App Development part time job/internship at Bangalore at Finplex Solutions
Job  7 is iOS App Development Internship at Inertial Elements / GT Silicon
Job  8 is Mobile App tester at Cornertree Consulting pvt. ltd.
Job  9 is Mobile App development at Amstar Technologies
Job 10 is iOS Mobile App Developer at AIMLEAP

Sample Solution:

Python Code:

"""Scraping jobs given job title and location from indeed website
#Source:https://bit.ly/2YeIDjm 
"""
from __future__ import annotations
from typing import Generator
import requests
from bs4 import BeautifulSoup
url = "https://www.indeed.co.in/jobs?q=mobile+app+development&l="
def fetch_jobs(location: str = "mumbai") -> Generator[tuple[str, str], None, None]:
    soup = BeautifulSoup(requests.get(url + location).content, "html.parser")
    # This attribute finds out all the specifics listed in a job
    for job in soup.find_all("div", attrs={"data-tn-component": "organicJob"}):
        job_title = job.find("a", attrs={"data-tn-element": "jobTitle"}).text.strip()
        company_name = job.find("span", {"class": "company"}).text.strip()
        yield job_title, company_name
if __name__ == "__main__":
    print("Job title and location from indeed website:\n")
    for i, job in enumerate(fetch_jobs("Bangalore"), 1):
        print(f"Job {i:>2} is {job[0]} at {job[1]}")

Flowchart:

Flowchart: Fetch job title and location from indeed website.

 

Improve this sample solutions and post your code through Disqus



Follow us on Facebook and Twitter for latest update.