robots.cr
robots.cr
Simple robots.txt parsing for Crystal
Installation
-
Add the dependency to your
shard.yml
:dependencies: robots: github: watzon/robots
-
Run
shards install
Usage
require "robots"
# From reddit
robotstxt = <<-TEXT
# 80legs
User-agent: 008
Disallow: /
User-Agent: *
Disallow: /goto
Disallow: /*after=
Disallow: /*before=
Disallow: /domain/*t=
Disallow: /login
Disallow: /reddits/search
Disallow: /search
Disallow: /r/*/search
Allow: /
TEXT
reddit = Robots.new(robotstxt, "Googlebot")
reddit.allowed?("/login")
# => false
reddit.allowed?("/r/SushiChain")
# => true
reddit.allowed?("/r/SushiChain/search")
# => false
TODO: Write usage instructions here
Development
TODO: Write development instructions here
Contributing
- Fork it (<https://github.com /robots/fork>)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Chris Watson - creator and maintainer
Repository
robots.cr
Owner
Statistic
- 6
- 2
- 1
- 0
- 0
- over 5 years ago
- June 26, 2019
License
MIT License
Links
Synced at
Sun, 17 Nov 2024 09:36:21 GMT
Languages