Skip to content

nwoolls/EasyListParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyListParser

EasyListParser is an iOS Framework for creating Safari Content Blocker lists from EasyList filters.

Usage

let easyListURI = "https://easylist-downloads.adblockplus.org/easyprivacy_nointernational.txt"
var blockerEntries: [ELBlockerEntry] = []
var blockerJson: String?
let maxEntries = 50000 // max allowed by Safari
let trustedDomains = ["www.reddit.com"]

if let easyListURL = NSURL(string: easyListURI) {
    do {
        let easyListContent = try String(contentsOfURL: easyListURL)
        blockerEntries = ELListParser.parse(easyListContent, maxEntries: maxEntries, trustedDomains: trustedDomains)
        blockerJson = try blockerEntries.serialize()
    } catch let error as NSError {
        print(error.localizedDescription)
    }
}

Examples

References

License

EasyListParser is released under the MIT license. See LICENSE for details.

About

Framework for creating Safari Content Blocker lists from EasyList filters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published