import requests
from bs4 import BeautifulSoup
def scrape_indeed():
# URL of the job listings page on Indeed Canada
url = "https://ca.indeed.com/jobs?q=&l=Canada"
# Send a GET request to the URL
response = requests.get(url)
# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(response.content, "html.parser")
# Find the job listing elements
job_listings = soup.find_all("div", class_="jobsearch-SerpJobCard")
# Iterate over the job listings and extract relevant information
for job in job_listings:
title = job.find("a", class_="jobtitle").text.strip()
company = job.find("span", class_="company").text.strip()
location = job.find("div", class_="location").text.strip()
salary = job.find("span", class_="salaryText").text.strip() if job.find("span", class_="salaryText") else "Not specified"
print("Title:", title)
print("Company:", company)
print("Location:", location)
print("Salary:", salary)
print("-----------------------------------")
# Call the function to scrape Indeed job listings
scrape_indeed()