๐ฒ A dead simple Go module that counts Adblock filter rules.๐ฆ
Note: it only operates on a string-level, it doesn't check the validity of the provided filter rules.
Documentation: https://godocs.io/github.com/igorskyflyer/go-adblock-filter-counter
See the releases page for a changelog.
This library requires Go 1.20 or newer; add it to your go.mod with:
go get github.com/igorskyflyer/go-adblock-filter-counter@latest
and import it like
...
import (
abcounter "github.com/igorskyflyer/go-adblock-filter-counter"
)
...
source string = `
[Adblock Plus 2.0]
||hello.world^
||hello.world^
||hello.world^
! Comment
||another.test^
`
abcounter.CountRules(source) // returns 4
filePath string = "./data/AdVoid.Core.txt"
abcounter.CountFileRules(filePath) // returns (2495, nil)