Skip to main content

Functions to extract data from a web page using selenium webdriver with not too much code.

Project description

bewspweb

In this repository you can find a module that allows you to extract data from a homepage with some functions, passing a few parameters and storing them in a list.

Getting Started

Prerequisites

To use it assertively, it is necessary to install some modules.

  • Selenium
  • Webdriver-manager
pip install selenium
pip install webdriver-manager

Installation

To install de package, just run the command:

pip install bewspweb

Functions

This module has some functions:

bewspweb_start()

This function is to start the driver and open the web page using the defined parameters.

bewspweb_weave()

This function is to collect data from a web page defining the type of the element, the element itself, the type of the subelement, the subelement itself. The function returns a list with the data collected.

bewspweb_print()

This function is to print the collected data from a web page.

How to Use

  • Start driver with bewspweb()
from bewspweb import bewspweb_start

bewspweb_start(url_main="https://webscraper.io/test-sites/e-commerce/scroll")
from bewspweb import bewspweb_start

bewspweb_start(url_main="https://webscraper.io/test-sites/e-commerce/scroll", headless=True, windows_mode="maximize", mute_audio=True)
  • Collecting with bewspweb_weave()
from bewspweb import bewspweb_start, bewspweb_weave
from selenium.webdriver.common.by import By

# Initialize driver
bewspweb_start(url_main="https://webscraper.io/test-sites/e-commerce/scroll")

# Start webscrapping
list_name = bewspweb_weave(type_element=By.XPATH,
    element="/html/body/div[1]/div[3]/div/div[2]/div[2]",
    type_subelement=By.XPATH,
    subelement="/html/body/div[1]/div[3]/div/div[2]/div[2]/div",
    selsubtag="a",
    subtag="title",
    tries=10)
  • Printing with bewspweb_print()
from bewspweb import bewspweb_start, bewspweb_weave, bewspweb_print
from selenium.webdriver.common.by import By

# Initialize driver
bewspweb_start(url_main="https://webscraper.io/test-sites/e-commerce/scroll")

# Start webscrapping
list_name = bewspweb_weave(type_element=By.XPATH,
    element="/html/body/div[1]/div[3]/div/div[2]/div[2]",
    type_subelement=By.XPATH,
    subelement="/html/body/div[1]/div[3]/div/div[2]/div[2]/div",
    selsubtag="a",
    subtag="title",
    tries=10)

# Print woven list
bewspweb_print(list=list_name, col_a=0, col_b=1)

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bewspweb-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bewspweb-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file bewspweb-0.1.0.tar.gz.

File metadata

  • Download URL: bewspweb-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.66.5 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for bewspweb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8499f1d582eb6ae5fdad49819efe01fadb93eb39a90ce31c7ff51edd22150f25
MD5 ccaedc028313a74df933bcd1509e9bf1
BLAKE2b-256 9c27bc4fe6deb1eb50eda893d48ff7f20682bb44bfc0e180264f750d60b3363c

See more details on using hashes here.

File details

Details for the file bewspweb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bewspweb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.66.5 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for bewspweb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2e05dc22039a785d90b4a12bce5e14bfe25ff625924b775c46a33a3b8852279
MD5 537f25d7a81b04579442bb1c42dcbb31
BLAKE2b-256 feb82099725b39e25457fad4ebcf1bc89b422e447c6a3bf05487e1e8d2d29ba6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page