Skip to main content

A useful package for web scraping with Selenium

Reason this release was yanked:

Broken

Project description

Py-Easy-Scrap

Description

A useful package for web scraping with Selenium

Installation

pip install py-easy-scrap

Requirements

  • Python 3.7 or higher
  • Selenium, along with GeckoDriver (Firefox)

Usage

import pyeasyscrap as pes

Get WebDriver

driver = get_webdriver(headless)

This will return an instance of webdriver.Firefox (GeckoDriver).

Get Element

element = get_element(driver, value="element_xpath")

This will return the web element found using the specified driver and value. By default, this function uses 'XPATH' as the method of searching. However, you can change this by providing 'ID' or 'LINK_TEXT' as the 'by' argument.

Please be aware that the method of searching ('XPATH', 'ID', or 'LINK_TEXT') highly depends on the webpage structure. Therefore, it is essential to inspect the webpage beforehand.

Also, please remember to replace "element_xpath" with the actual Xpath, ID, or link text of the element you want to find.

Scroll to Element

scroll_to(driver, element)

This will use JavaScript to scroll the view of the given webdriver to the specified web element.

Ask for Data

required_data = ("username", "password")
file_name_no_extension = "user_credentials"
ask_for_data(required_data, file_name_no_extension)

This will return a dictionary containing the collected data and will create a JSON configuration (.conf) file.

Check File

pes.check_file("path_to_file")

This will return either True or False based on file existence

Please note that the above code snippets are basic examples of how to use those functions. Depending on the exact specifications of your use case, additional setup may be necessary (e.g. logging into a website before trying to scroll to an element).

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

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

py-easy-scrap-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

py_easy_scrap-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file py-easy-scrap-0.1.1.tar.gz.

File metadata

  • Download URL: py-easy-scrap-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.7.16

File hashes

Hashes for py-easy-scrap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8eef87c16983233cdaa567da4eb9264aa2bc0f655a9668cd60008d348c88f770
MD5 7d01e23ea716d15210c52eaabd2a9a8d
BLAKE2b-256 b7e7321bd2c9a57c3dfd162799e2786f7b12a844422826ef64e5a333e06af3e3

See more details on using hashes here.

File details

Details for the file py_easy_scrap-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_easy_scrap-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.7.16

File hashes

Hashes for py_easy_scrap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 398ae8314219afb646fb599e26ea1764b011b69b73633cc82240c096824000f1
MD5 eafe32aa864d66fac6afbf5b2bf82ce1
BLAKE2b-256 291b8fa26e874f4f3fe73e6a56b1e151b31a791b8091b7e9571376752c0412fb

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