Skip to main content

Web Scraping with Camoufox and Cython+Pandas

Project description

🖥️ CamoufoxDf - Webscraping with Camoufox, Pandas and Cython

pip install pandascamoufox

Important: Cython and a C++ compiler must be installed! The module will be compiled the first time you import it!

This project provides:

  • CamoufoxDf wrapper: Extract DOM elements from a Camoufox browser session into a Pandas DataFrame, including both element attributes and bound methods for direct interaction (e.g., click, hover, type).

✨ Features

  • Use CamoufoxDf to fetch DOM elements into a DataFrame with:
    • All element attributes (id, classes, styles, geometry, dataset, etc.)
    • Pre-bound executable methods (click, hover, type, screenshot, etc.)

⚠️ Important Notes

  • Does not work inside IPython or Jupyter Notebook This is due to async conflicts between IPython and Camoufox (Playwright). Attempting to run inside IPython will result in event-loop errors.

  • Recommended Environment To use this effectively, run it inside:

    • VTM Terminal — for advanced terminal rendering (no line breaks)
    • ptpython — for an enhanced interactive REPL

🚀 Usage

from pandascamoufox import CamoufoxDf
from camoufox.utils import DefaultAddons
import pandas as pd
from contextlib import suppress as contextlib_suppress
from time import sleep

cfox = CamoufoxDf(
    humanize=False, headless=False, **{"exclude_addons": [DefaultAddons.UBO]}
)

def gf(selector="*"):
    while True:
        with contextlib_suppress(Exception):
            df = cfox.get_df(selector)
            if "aa_text" in df.columns:
                return df

cfox.page.goto("https://bet365.com")
df=gf()
print(df)

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

pandascamoufox-0.13.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

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

pandascamoufox-0.13-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file pandascamoufox-0.13.tar.gz.

File metadata

  • Download URL: pandascamoufox-0.13.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.9

File hashes

Hashes for pandascamoufox-0.13.tar.gz
Algorithm Hash digest
SHA256 c3216c1f17586117bd32938a417d0354a636ba9c9a2d633bbd04db546a66d2d0
MD5 3dc2897dce598cd8653e414ca64c106c
BLAKE2b-256 548f84c6e37c5387eb8a70bd786809f6e12584ab1d40450bebb271e71598bdf0

See more details on using hashes here.

File details

Details for the file pandascamoufox-0.13-py3-none-any.whl.

File metadata

  • Download URL: pandascamoufox-0.13-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.9

File hashes

Hashes for pandascamoufox-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 412f9d2d29eac38f3f6448d8b12014644e25821c843f0849ac2418eeff6513cd
MD5 63eb1e51f3c229310b25fda95a4703f3
BLAKE2b-256 3d84b6140ca38ca76a7c3d60081f48db891bd80712fa3365d726e1eaefbdd584

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