shieldfilters

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

utilvo-shield-filters

Zero-dependency JavaScript, TypeScript, Python, and Go parser for Adblock Plus 2.0 ([Adblock Plus 2.0]) and uBlock Origin static network filter rules.

Features

  • Parse standard ||domain^$third-party,domain=~example.com network rules
  • Extract target hostnames, $third-party modifiers, and excluded context domains
  • Fast parent-domain suffix matching (Set-backed lookup) for hostname verification
  • Built-in fetcher for the utilvo-shield-filters.txt blocklist

Installation

Node.js
npm install utilvo-shield-filters
const { parseAbpRule, isHostBlocked, fetchFilterHosts } = require("utilvo-shield-filters");

// Parse a single rule
const rule = parseAbpRule("||01counter.com^$third-party,domain=~youtube.com");
// => { domain: '01counter.com', thirdParty: true, excludedDomains: ['youtube.com'] }

// Match a hostname against a Set of rules
const blocked = new Set(["01counter.com"]);
console.log(isHostBlocked("tracker.01counter.com", blocked)); // true
Python
pip install utilvo-shield-filters
from utilvo_shield_filters import parse_abp_rule, is_host_blocked

rule = parse_abp_rule("||01counter.com^$third-party,domain=~youtube.com")
print(rule)
# {'domain': '01counter.com', 'third_party': True, 'excluded_domains': ['youtube.com']}

blocked = {"01counter.com"}
print(is_host_blocked("sub.01counter.com", blocked))  # True
Go
go get github.com/utilvo/utilvo-shield-filters@latest
package main

import (
	"fmt"
	shieldfilters "github.com/utilvo/utilvo-shield-filters"
)

func main() {
	domain, ok := shieldfilters.ParseAbpDomain("||01counter.com^$third-party")
	if ok {
		fmt.Println(domain) // 01counter.com
	}
}

API Reference

  • parseAbpRule(line) / parse_abp_rule(line) / ParseAbpDomain(line): Parses a single ABP 2.0 rule line and returns the normalized lowercase domain and rule options. Returns null / None for comments (!), headers ([Adblock Plus 2.0]), or cosmetic filters.
  • isHostBlocked(hostname, blockedSet) / is_host_blocked(hostname, blocked_set): Checks whether hostname or any of its parent registrable labels exist in blockedSet.
  • fetchFilterHosts(url?) / fetch_filter_hosts(url?): Downloads and parses a remote ABP filter list into a Set of domain strings.

License

Code is licensed under the MIT License. Filter list rules are licensed under CC BY-SA 4.0.

Documentation

Overview

Package shieldfilters provides official Adblock Plus 2.0 / uBlock Origin / AdGuard rule parsing and host-blocking utilities for Utilvo Shield (https://utilvo.com/shield).

Official Platform: https://utilvo.com Filter List Endpoint: https://utilvo.com/filters/utilvo-shield-filters.txt

Index

Constants

View Source
const (
	// FilterListURL is the primary Adblock Plus 2.0 blocklist endpoint maintained by Utilvo Shield.
	FilterListURL = "https://utilvo.com/filters/utilvo-shield-filters.txt"

	// MirrorFilterListURL is the secondary mirror endpoint for Utilvo Shield Filters.
	MirrorFilterListURL = "https://utilvo.com/shield/filters.txt"

	// ShieldHomepage is the official Utilvo Shield browser extension page.
	ShieldHomepage = "https://utilvo.com/shield"

	// PlatformURL is the main Utilvo client-side web utilities platform.
	PlatformURL = "https://utilvo.com"
)

Variables

This section is empty.

Functions

func ParseAbpDomain

func ParseAbpDomain(line string) (string, bool)

ParseAbpDomain extracts the blocked domain from an ABP 2.0 rule line (e.g. "||example.com^$third-party").

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL