npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-dont-care-about-cookies

v1.1.0

Published

Block cookie consent dialogs in Playwright - built for AI agents and web automation. Uses 15,000+ rules from 'I Still Don't Care About Cookies'.

Readme

AI-Dont-Care-About-Cookies

Block cookie consent dialogs in Playwright with a single line of code.

Uses 15,000+ domain rules from the I Still Don't Care About Cookies browser extension, ported natively to Playwright for JavaScript and Python.

Why?

Cookie consent banners introduce significant friction for automated browser sessions and LLM-based web agents. Handling these dialogs per page leads to several technical inefficiencies:

  • Context Window Pollution: Cookie banners bloat the DOM with irrelevant markup (vendor lists, legal text). This distracts the LLM from the actual page content and degrades extraction accuracy.
  • Unnecessary Token Usage: Processing the markup of consent dialogs consumes API tokens without contributing to your actual data extraction task.
  • UI Interference: Overlays obscure the viewport and intercept pointer events, which sometimes causes standard Playwright actions to fail or time out.
  • Agent Navigation: Autonomous agents frequently spend execution steps attempting to dismiss consent dialogs instead of focusing on their primary objective.

AI-Dont-Care-About-Cookies resolves this at the session level. A single function call blocks consent management scripts via network interception and hides associated UI elements via injected CSS, allowing your scraper or agent to access the underlying page content uninterrupted.

Features

  • 15,308 domain-specific rules
  • 1,740 tracking URL patterns blocked via page.route()
  • 14,341 lines of CSS injected before page scripts execute
  • 7 handler scripts (default click, site-specific click, cookie, localStorage, sessionStorage, Google, embeds)
  • Survives page navigations without re-injection
  • Handles cookie dialogs inside iframes (e.g., Sourcepoint)
  • Works at page or context level
  • TypeScript type definitions included (JS package)
  • No runtime dependencies beyond Playwright

Installation

JavaScript / Node.js

npm install ai-dont-care-about-cookies

Python

pip install ai-dont-care-about-cookies

Usage

JavaScript

const { chromium } = require('playwright');
const { blockCookieDialogs } = require('ai-dont-care-about-cookies');

const browser = await chromium.launch();
const context = await browser.newContext({ bypassCSP: true });
const page = await context.newPage();

await blockCookieDialogs(page);

await page.goto('https://www.spiegel.de');

Context-level (all pages)

await blockCookieDialogs(context);

const page1 = await context.newPage();
await page1.goto('https://www.bbc.com');

const page2 = await context.newPage();
await page2.goto('https://www.spiegel.de');

Python (sync)

from playwright.sync_api import sync_playwright
from playwright_cookie_blocker import block_cookie_dialogs

with sync_playwright() as p:
    browser = p.chromium.launch()
    context = browser.new_context(bypass_csp=True)
    page = context.new_page()

    block_cookie_dialogs(page)

    page.goto("https://www.spiegel.de")

Python (async)

from playwright.async_api import async_playwright
from playwright_cookie_blocker import block_cookie_dialogs

async with async_playwright() as p:
    browser = await p.chromium.launch()
    context = await browser.new_context(bypass_csp=True)
    page = await context.new_page()

    await block_cookie_dialogs(page)

    await page.goto("https://www.spiegel.de")

How It Works

The library replicates the behavior of the I Still Don't Care About Cookies browser extension using native Playwright APIs:

  1. CSS injection via addInitScript() runs before any page script executes. This hides the majority of consent dialogs immediately and persists across navigations.

  2. Network interception via page.route() blocks requests to known consent management platforms (Sourcepoint, OneTrust, CookieBot, etc.) before they load.

  3. Domain-specific rules are applied on domcontentloaded. Each domain can have custom CSS, shared CSS patterns, and JavaScript click handlers for dialogs that cannot be hidden with CSS alone.

  4. Iframe handling via framenavigated events processes cookie dialogs rendered inside iframes.

  5. Fallback handler runs on domains without a specific rule, scanning for common consent button patterns ("Accept", "OK", "Agree").

Comparison with idcac-playwright

idcac-playwright by Apify compiles the original browser extension into a single injectable script.

| Feature | This library | idcac-playwright | |---------|-------------|-----------------| | URL blocking | 1,740 tracking URL patterns blocked | Not included (removed during compilation) | | Navigation survival | Automatic | Must re-inject after every navigation | | Iframe support | Yes | No | | Python support | Yes (sync and async) | No | | Puppeteer support | No (Playwright only) | Yes (Playwright and Puppeteer) | | Base extension | I Still Don't Care About Cookies (actively maintained fork) | I Don't Care About Cookies (acquired by Avast) |

Note on bypassCSP

For reliable script injection, create the browser context with bypassCSP: true:

const context = await browser.newContext({ bypassCSP: true });
context = browser.new_context(bypass_csp=True)

Without this flag, Content Security Policy headers on some sites may prevent click handler scripts from executing.

Used in Production

I use this library in production in my own projects:

  • TendiGo.de: scrapes public tender documents across Germany from various websites
  • bwl.careers: scrapes job listings from various company websites

Using this in your project? Open an issue to get it listed here.

Credits

All cookie handling logic originates from the browser extension ecosystem. I ported it to work natively with Playwright APIs.

License

GPL-3.0. See LICENSE.