pandascamoufox


Namepandascamoufox JSON
Version 0.13 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/pandascamoufox
SummaryWeb Scraping with Camoufox and Cython+Pandas
upload_time2025-08-25 01:17:39
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords camoufox cython pandas
VCS
bugtrack_url
requirements Cython camoufox numpy pandas setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 🖥️ 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](https://github.com/daijro/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](https://github.com/directvt/vtm) — for advanced terminal rendering (no line breaks)
  - [ptpython](https://github.com/prompt-toolkit/ptpython) — for an enhanced interactive REPL

---

## 🚀 Usage

```py
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)
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/pandascamoufox",
    "name": "pandascamoufox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Camoufox, Cython, Pandas",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/54/8f/84c6e37c5387eb8a70bd786809f6e12584ab1d40450bebb271e71598bdf0/pandascamoufox-0.13.tar.gz",
    "platform": null,
    "description": "\r\n# \ud83d\udda5\ufe0f CamoufoxDf - Webscraping with Camoufox, Pandas and Cython\r\n\r\n## `pip install pandascamoufox`\r\n\r\n#### Important: Cython and a C++ compiler must be installed! The module will be compiled the first time you import it!\r\n\r\nThis project provides:\r\n\r\n- **`CamoufoxDf` wrapper**: Extract DOM elements from a [Camoufox](https://github.com/daijro/camoufox) browser session into a Pandas DataFrame, including both element attributes and bound methods for direct interaction (e.g., click, hover, type).\r\n\r\n---\r\n\r\n## \u2728 Features\r\n\r\n- Use `CamoufoxDf` to fetch DOM elements into a `DataFrame` with:\r\n  - All element attributes (id, classes, styles, geometry, dataset, etc.)\r\n  - Pre-bound executable methods (`click`, `hover`, `type`, `screenshot`, etc.)\r\n\r\n---\r\n\r\n## \u26a0\ufe0f Important Notes\r\n\r\n- \u274c **Does not work inside IPython or Jupyter Notebook**\r\n  This is due to **async conflicts** between IPython and Camoufox (Playwright).\r\n  Attempting to run inside IPython will result in event-loop errors.\r\n\r\n- \u2705 **Recommended Environment**\r\n  To use this effectively, run it inside:\r\n  - [VTM Terminal](https://github.com/directvt/vtm) \u2014 for advanced terminal rendering (no line breaks)\r\n  - [ptpython](https://github.com/prompt-toolkit/ptpython) \u2014 for an enhanced interactive REPL\r\n\r\n---\r\n\r\n## \ud83d\ude80 Usage\r\n\r\n```py\r\nfrom pandascamoufox import CamoufoxDf\r\nfrom camoufox.utils import DefaultAddons\r\nimport pandas as pd\r\nfrom contextlib import suppress as contextlib_suppress\r\nfrom time import sleep\r\n\r\ncfox = CamoufoxDf(\r\n    humanize=False, headless=False, **{\"exclude_addons\": [DefaultAddons.UBO]}\r\n)\r\n\r\ndef gf(selector=\"*\"):\r\n    while True:\r\n        with contextlib_suppress(Exception):\r\n            df = cfox.get_df(selector)\r\n            if \"aa_text\" in df.columns:\r\n                return df\r\n\r\ncfox.page.goto(\"https://bet365.com\")\r\ndf=gf()\r\nprint(df)\r\n```\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Web Scraping with Camoufox and Cython+Pandas",
    "version": "0.13",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/pandascamoufox"
    },
    "split_keywords": [
        "camoufox",
        " cython",
        " pandas"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3d84b6140ca38ca76a7c3d60081f48db891bd80712fa3365d726e1eaefbdd584",
                "md5": "63eb1e51f3c229310b25fda95a4703f3",
                "sha256": "412f9d2d29eac38f3f6448d8b12014644e25821c843f0849ac2418eeff6513cd"
            },
            "downloads": -1,
            "filename": "pandascamoufox-0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "63eb1e51f3c229310b25fda95a4703f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 28766,
            "upload_time": "2025-08-25T01:17:38",
            "upload_time_iso_8601": "2025-08-25T01:17:38.491617Z",
            "url": "https://files.pythonhosted.org/packages/3d/84/b6140ca38ca76a7c3d60081f48db891bd80712fa3365d726e1eaefbdd584/pandascamoufox-0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "548f84c6e37c5387eb8a70bd786809f6e12584ab1d40450bebb271e71598bdf0",
                "md5": "3dc2897dce598cd8653e414ca64c106c",
                "sha256": "c3216c1f17586117bd32938a417d0354a636ba9c9a2d633bbd04db546a66d2d0"
            },
            "downloads": -1,
            "filename": "pandascamoufox-0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "3dc2897dce598cd8653e414ca64c106c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 27642,
            "upload_time": "2025-08-25T01:17:39",
            "upload_time_iso_8601": "2025-08-25T01:17:39.974268Z",
            "url": "https://files.pythonhosted.org/packages/54/8f/84c6e37c5387eb8a70bd786809f6e12584ab1d40450bebb271e71598bdf0/pandascamoufox-0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-25 01:17:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "pandascamoufox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "Cython",
            "specs": []
        },
        {
            "name": "camoufox",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        }
    ],
    "lcname": "pandascamoufox"
}
        
Elapsed time: 1.04060s