Skip to content

rdowinton/robots-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robots parser

A robots.txt parser written in Scala.

Example usage

def canVisit(robots: String, userAgent: String, path: String): Boolean = {
    Robots.parse(robots) match {
        case Right(robotsFile) => robotsFile.canVisit(userAgent, path)
        case Left(error) => {
            println("Couldn't parse robots.txt: " + error)
            false
        }
    }
}

canVisit("User-Agent: Crawler\r\nAllow: *\r\nDisallow: /login\r\n", "Crawler", "/login")
canVisit("User-Agent: Crawler\r\nAllow: *\r\nDisallow: /login\r\n", "Crawler", "/example")

About

A robots.txt parser written in Scala.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages