Skip to content
manucabralPublic

About

A lightweight, zero dependencies and free Python library for extract browser information.

Topics

Resources

Code of conduct

Stars

18 stars

Watchers

2 watching

Forks

Latest commit

 

History

162 Commits

Folders and files

Repository files navigation

pybrinf

GitHub License GitHub Actions Workflow Status

Browser discovery, history, downloads, bookmarks and session reader for Python.

pybrinf reads local browser data on Windows, Linux and macOS using the Python standard library. It inspects SQLite databases (History and places.sqlite with WAL copies), Chromium SNSS binary session files, Firefox mozLz4 session files, bookmark stores and Chromium DevTools Protocol endpoints.

Supported Browsers

Browser Key Engine History & Downloads Bookmarks Saved Sessions Live DevTools Tabs
Google Chrome chrome Chromium Yes Yes Yes (SNSS) Yes
Mozilla Firefox firefox Firefox Yes Yes Yes (mozLz4) No
Microsoft Edge edge Chromium Yes Yes Yes (SNSS) Yes
Brave Browser brave Chromium Yes Yes Yes (SNSS) Yes
Opera opera Chromium Yes Yes Yes (SNSS) Yes
Vivaldi vivaldi Chromium Yes Yes Yes (SNSS) Yes
Yandex Browser yandex Chromium Yes Yes Yes (SNSS) Yes
Chromium chromium Chromium Yes Yes Yes (SNSS) Yes
Arc arc Chromium Yes Yes Yes (SNSS) Yes

Installation

git clone https://github.com/manucabral/pybrinf.git
cd pybrinf
python -m pip install .

Optional extras are available for pandas DataFrames and pyarrow Parquet files:

python -m pip install ".[pandas]"
python -m pip install ".[parquet]"
python -m pip install ".[full]"

For local development and running the test suite:

python -m pip install -e ".[dev,full]"

Usage

Discover Installed Browsers and Profiles

from pybrinf import Brinf

brinf = Brinf()

default = brinf.default_browser
print(default.fullname, default.version, default.path)

for browser in brinf.installed_browsers(exclude="edge"):
    profiles = [p.name for p in browser.profiles()]
    print(browser.name, profiles)

Query History, Downloads and Bookmarks

from pybrinf import Brinf

brinf = Brinf()

for entry in brinf.history(limit=10):
    print(entry.browser, entry.last_visit, entry.title, entry.url)

for download in brinf.downloads(limit=5):
    print(download.browser, download.path, download.total_bytes)

for bookmark in brinf.bookmarks(limit=10):
    print(bookmark.browser, bookmark.folder, bookmark.title, bookmark.url)

To query a specific browser or user profile directly:

chrome = brinf.browser("chrome")
work_history = chrome.history(profile="Profile 1", domain="github.com", limit=20)

Read Saved Browser Sessions (SNSS and mozLz4)

from pybrinf import Brinf

brinf = Brinf()
session = brinf.default_browser.session()

current = session.current_tab
print(current.title, current.url)

for tab in session.tabs(include_closed=False):
    print(tab.id, tab.pinned, tab.active, tab.url)

Read Live Tabs via Chromium DevTools Protocol

from pybrinf import Brinf

brinf = Brinf()
chrome = brinf.browser("chrome")
chrome.dev_tools = True
chrome.open(port=9222)

for tab in chrome.tabs(port=9222):
    print(tab.id, tab.title, tab.url)

Export to JSON, CSV, DataFrame or Parquet

from pybrinf import Brinf, export_csv, export_json, save_parquet, to_dataframe

brinf = Brinf()
items = brinf.history(limit=50)

export_json(items, "history.json")
export_csv(items, "history.csv")

# Requires pybrinf[pandas]
df = to_dataframe(items)

# Requires pybrinf[parquet] (works without pandas)
save_parquet(items, "history.parquet")

Verification

ruff check pybrinf tests examples
pytest

About

A lightweight, zero dependencies and free Python library for extract browser information.

Topics

Resources

Code of conduct

Stars

18 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages