Optimize your Job search using Python

Optimize your Job Search Using Python

Hey guys..! Welcome to another great tutorial. In this tutorial, I will teach you, “How to optimize your job search using Python”. We know most of the websites serving unrelated jobs when we search for a job.

So, I decided to help you to get the accurate job results and of course it will also help me 🙂.

I am targeting indeed. you can try other websites if you need them. Of course, you can take this script to the next level like building a new web app or app.

What do you need .. ?

  • Basics of Python
  • Basics of web scraping

Highlights of The Project

  • Job Search
  • Location Filter
  • Sorted by recent

If you don’t know what is web scraping, take a look at the below link you will get a clear picture of if. Trust me, you just love them after watching.

Learn Python Web scraping tutorials with projects

Here, I am using most basic web scraping packages, if you don’t have them you can install them by using the below commands.

pip install requests
pip install bs4

Learn How to Optimize your Job search using Python

You know guys, I sorted all the search results for better results and you can give your location and job title dynamically. I promise you it will help you a lot.

import requests
from bs4 import BeautifulSoup

#url = 'https://www.indeed.co.in/jobs?q=python+developer&sort=date'

job = input("Enter Job Title:")
location = input("Enter location:")

job = job.strip().title()
items = job.split(' ')

#job = 'python developer'.replace('+',' ').strip()

job = job.replace('+',' ').strip()

#location ='Bengaluru'.replace('+',' ').strip()

location = location.replace('+',' ').strip()


url = 'https://www.indeed.co.in/jobs?q='+job+'&l='+location+'&sort=date'


res = requests.get(url).content

soup = BeautifulSoup(res,'html.parser')

Here we imported all the necessary libraries and we add URL to manual search you will need to change the URL every time. For dynamical search use the same URL.

I configured location and job title in the URL for both manual and dynamic search, you can use either of them.

data = soup.find_all('div',class_='jobsearch-SerpJobCard')

for i in data:
    title = i.find('h2',class_='title')
    if items[0] in title.text.strip():
        link = title.find('a')

        #sal = i.find('span',class_='salaryText')
        day = i.find('span',class_='date')
        company = i.find('span',class_='company')
        summary = i.find('div',class_='summary')

        print('\n','Job Title',title.text)
        #print(sal)
        print('Company Name:',company.text)
        print('Job Description:',summary.text)
        print("Posted:,"day.text)
        
        print('https://www.indeed.co.in'+link['href'])

This is is the most important script in this entire project. Here, I grabbed the below things using soup object and HTML classes.

  • Job Title
  • Company Name
  • Salary ( If available )
  • Job Description
  • Posted Date
  • And Job link

I thought these are enough info to identify the good job in search results.

Full project code:

#job.py

import requests
from bs4 import BeautifulSoup

#url = 'https://www.indeed.co.in/jobs?q=python+developer&sort=date'

job = input("Enter Job Title:")
location = input("Enter location:")

job = job.strip().title()
items = job.split(' ')

#job = 'python developer'.replace('+',' ').strip()

job = job.replace('+',' ').strip()

#location ='Bengaluru'.replace('+',' ').strip()

location = location.replace('+',' ').strip()


url = 'https://www.indeed.co.in/jobs?q='+job+'&l='+location+'&sort=date'


res = requests.get(url).content

soup = BeautifulSoup(res,'html.parser')


data = soup.find_all('div',class_='jobsearch-SerpJobCard')

for i in data:
    title = i.find('h2',class_='title')
    if items[0] in title.text.strip():
        link = title.find('a')

        #sal = i.find('span',class_='salaryText')
        day = i.find('span',class_='date')
        company = i.find('span',class_='company')
        summary = i.find('div',class_='summary')

        print('\n','Job Title',title.text)
        #print(sal)
        print('Company Name:',company.text)
        print('Job Description:',summary.text)
        print("Posted:,"day.text)
        
        print('https://www.indeed.co.in'+link['href'])

That’s it guys..! I hope you will enjoy it and it will definitely useful to you. To get more interesting projects, Subscribe to our newsletter. Thank you.:)

Leave a Reply