Home Webscraping using Python
Post
Cancel

Webscraping using Python

Work in progress

This is a quick and easy intro into webscraping using python.

First we’re going to import some dependencies at the top of our script.

We’ll need the Requests package and the Beautiful Soup package

1
2
import requests
from bs4 import BeautifulSoup as bs # we're shortening beautifulsoup to bs so we don't keep having to writing "BeautifulSoup" every time.

Now we just need a website. We’re going to use a job posting site to search for some jobs.

1
url = 'https://jobserve.com'

To get the contents of the webpage we use the requests “GET” method to “GET” the webpage.

1
r = requests.get(url) # calling the variable r is just short for results you can call it what every you want but just remember to reference it when needed

Now we parse the contents of the “GET” into a html parser. It makes it easy to find html tags and information

1
soup = bs(r.content, "html.parser")

Once we have it into the variable “soup” we’ll call it. We can start searching for information and html tags

To do this we can use a find method that is in BeautifulSoup.

1
jobs = soup.find("div", attrs={"class": "jobSearchContainer"})

breaking this down h

This post is licensed under CC BY 4.0 by the author.
Trending Tags