dputils Documentation

Documentation for dputils

View the Project on GitHub digipodium/dputils

homepage files functions

Module: scraper

This module provides a Scraper class that allows you to scrape data from a webpage using BeautifulSoup library. It also includes supporting classes Browser and Tag.

Class: Tag

This class represents an HTML tag that can be used to extract specific data from a webpage.

Properties

Methods

Class: Scraper

This class is used to scrape data from a webpage using BeautifulSoup library.

Methods

Example Usage

url = "https://www.flipkart.com/search?q=mobiles&otracker=search&otracker1=search&marketplace=FLIPKART&as-show=on&as=off"
scraper = Scraper(url)
out = scraper.get_repeating_page_data(
    target=Tag('div', cls='_1YokD2 _3Mn1Gg'),
    items=Tag('div', cls='_1AtVbE col-12-12'),
    title=Tag('div', cls='_4rR01T'),
    price=Tag('div', cls='_30jeq3 _1_WHN1'),
    link=Tag('a', cls='_1fQZEK', output='href'),
)

This code creates a Scraper object with the specified URL and extracts data for multiple items from the webpage. The target and items are specified using Tag objects, and additional data to be extracted is specified as keyword arguments. The extracted data is returned as a list of dictionaries.

Note: The code provided in the question lacks indentation, which may cause syntax errors when executed. Make sure to fix the indentation before running the code.