Object Oriented Scraping

KELAS DATA SCRAPING




Kampus Remote Worker Indonesia | 2024

Data Scraping | rianaditro

Sub Topic or Introduction

Object-Oriented Programming (OOP) is a programming paradigm that helps structure your code into reusable pieces by organizing it around objects, which represent entities in the real world. In Python data scraping, using OOP can make your code more modular, reusable, and easier to maintain.

Instead of writing separate functions or large procedural blocks, you can organize the scraping process into classes that model real-world entities.

Data Scraping | rianaditro

OOP Key Concept

1.Object: An instance of a class. It represents one specific "thing" created from the class.

garfield = Cat()

2.Class: A blueprint for creating objects. It defines the properties and methods of the object.

class Cat:
    # something that related to a real cat
Data Scraping | rianaditro

3.Attributes: Variables that store data about the object. They are defined inside the class.

def __init__(self, name):
    self.name = name

garfield.name = "Garfield"

4.Methods: Functions that define the behavior of an object. They are defined inside the class and usually use the object’s attributes.

def speak(self):
    return f"My name is {self.name}"

garfield.speak()
Data Scraping | rianaditro

Class Activity

Create a blueprint that represent a dog. Create 10 of dog!

Data Scraping | rianaditro

Class Activity

Create a system for library. Who are the entity, how they interact, etc!

Data Scraping | rianaditro

Class Activity

Create a program that let the users to send letter each other!

Data Scraping | rianaditro

Class Activity

Remember when we talk about Selenium WebBrowser? Create a class that have similiar behaviour with Selenium WebBrowser, it should represent the get, page_source, etc!

Data Scraping | rianaditro

Learn More

Join us on this self-study journey! Click the link below to get started.

Data Scraping | rianaditro

Discover Advanced Topic

Master this advanced topic and supercharge your skills.

Data Scraping | rianaditro

Homework Assignment

Implement OOP in your web scraping scripts!

Data Scraping | rianaditro




Thank you

Any Question?




Kampus Remote Worker Indonesia | 2024

Data Scraping | rianaditro

<br>

<br>