Select Page

Python: Web Scraping with BeautifulSoup and Requests

5 . 01 . 2018

I was in this Digital Marketing group on Facebook and a lot of members were talking about parsing websites to obtain potential customer information. But before diving deep into scraping Facebook Groups or LinkedIn, I wanted to make sure I understood the fundamentals of web scraping first. So here’s where I started, by learning to parse HTML code from one of my favorite Python teacher on YouTube, Corey Schafer.

The main thing we did for our codes is to find information by inspecting elements on your browser. I’ve used this tool a lot whenever I forget my password or wanted to change certain elements on someone else’s website just for fun. I’m glad I’ve found a new way to use it!

Hover over to the article’s title to find out where the code is nested. And then you do the same for the article’s content.

Extracting the YouTube link is by far the trickiest part! But they work just the same – unique IDs are all nested within the 4th index of the YouTube link so you just gotta print that specific index out.

I printed the information out on the console to make sure everything’s nice and organized.

How it looks in CSV format!

And tada,

Comments
2 Comments
    • calistatee

      Thank you for sharing!

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *