Skip to main content

A PyChromeDevTools based WebScraper and selenium like syntax.

Project description

pcdt-scraper

A PyChromeDevTools based WebScraper and selenium like syntax.

Python package PyPI version Downloads Downloads GitHub commit activity GitHub last commit

Introduction

Sometimes website blocks your requests or aiohttp web request but don't block chrome web request.

For this solution, here is "pcdt-scraper".

Compatability

Python 3.6+ is required.

Installation

pip install pcdt-scraper

or

pip3 install pcdt-scraper

Usage:

  1. First run chromium or chrome remote instance
chromium --remote-debugging-port=9222 --remote-allow-origins=*

or You can run as headless mode.

chromium --remote-debugging-port=9222 --remote-allow-origins=* --headless
  1. Then run python code
from pcdt_scraper import WebScraper

scraper = WebScraper()
url = "https://www.example.com/"
try:
    # Navigate to a page
    if scraper.get(url):

        # Get page content
        content = scraper.get_page_content()

        # find element by class name
        text = scraper.find_element_by_class_name('class_name').text()
        print(text)

except Exception as e:
    print(f"An error occurred: {str(e)}")

finally:
    scraper.close()

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

pcdt_scraper-1.0.1.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.

pcdt_scraper-1.0.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pcdt_scraper-1.0.1.tar.gz.

File metadata

  • Download URL: pcdt_scraper-1.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pcdt_scraper-1.0.1.tar.gz
Algorithm Hash digest
SHA256 67679386b675f5b97df85447598836ad4022d29cdec23ba1d7a5f2189f9488fa
MD5 f12fa8b0a286769114a81a951222645e
BLAKE2b-256 d8b10343ce9a710fe1565936a2f2e3610dd864f586f662bdca97a384b4eebc40

See more details on using hashes here.

File details

Details for the file pcdt_scraper-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pcdt_scraper-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pcdt_scraper-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6ae36b6a248f11787b5be348b337a92e30413c7b71b259a24d6e30c9bf16981
MD5 aede98d87730e7864eee94ad2bcc46ec
BLAKE2b-256 653eda074c58be72e37425c5b92913ff1c04c8ce5c1f2475ab63ffdb39befb26

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