Content Blocker converter swift code
Converts filter rules in AdGuard format to the format supported by Safari.
swift build
swift test
let result: ConversionResult? = ContentBlockerConverter.convertArray(
rules: [String], limit: Int = 0, optimize: Bool = false, advancedBlocking: Bool = false
);
The result contains following properties:
- totalConvertedCount: length of content blocker
- convertedCount: length after reducing to limit if provided
- errorsCount: errors count
- overLimit: is limit exceeded flag
- converted: json string of content blocker rules
- advancedBlocking: json string of advanced blocking rules
./ConverterTool -limit=0 -optimize=true -advancedBlocking=false <<STDIN -o other --options
test_rule_one
test_rule_two
STDIN
The tool then reads stdin line by line for rule until an empty line.
Push a new tag in v*.*.*
format, then provided github action is intended to build and publish new release with an asset binary.
- Elemhide rules (##)
- Elemhide exceptions
- Url blocking rules
- Url blocking exceptions
- Script rules (#%#)
- Script rules exceptions
- Extended css elemhide rules (##)
- Scriptlet rules (#%#//scriptlet)
- Scriptlet rules exceptions
- Punycode (https://github.com/gumob/PunycodeSwift.git)