CanProceed

1.0.1

A small, tested, no-frills parser of robots.txt files in Swift.
ptsochantaris/can-proceed

What's New

Version 1.0.1

2024-02-29T20:42:05Z
  • Bumped iOS minimum requirement to iOS 16 to fix build problem

Logo

CanProceed

A small, tested, no-frills parser of robots.txt files in Swift.

Currently used in

Full docs can be found here

Quick example

let exampleRobotsFileLocation = URL(string: "https://www.bbc.co.uk/robots.txt")!
let robotsData = try! Data(contentsOf: exampleRobotsFileLocation)
let robotsText = String(data: robotsData, encoding: .utf8)!

let check = CanProceed.parse(robotsText)

let shouldProceed = check.agent("ChatGPT-User", canProceedTo: "/news"))

guard shouldProceed else {
    complain()
    return
}

...

check.sitemaps   // contains any sitemaps
check.crawlDelay // provides any crawl delay setting
check.sitemps    // contains any XML sitemaps

License

Copyright (c) 2024 Paul Tsochantaris. Licensed under the MIT License, see LICENSE for details.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

Last updated: Sat Mar 16 2024 02:42:13 GMT-0900 (Hawaii-Aleutian Daylight Time)