ReadRobotstxt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +34 -0
- data/Rakefile +4 -0
- data/lib/Robots/version.rb +5 -0
- data/lib/Robots.rb +50 -0
- data/sig/Robots.rbs +4 -0
- metadata +47 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: eb26a56e7fd51ba2787f82bc6aae192ccc5c3b26ffa9c409081b0ad05465a630
|
|
4
|
+
data.tar.gz: 2466cfcb919e02c5f429685862eec578339cbbd8383543cd372cc8772507b2bb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 883441daa58f6cafdd058ff4906501783b589ae4d2979b1ca510e0daa4f48dfaa9b43bb1d1df7deb5a5ddb984d796bb77ffe960d194d0f374d5f1aefda928594
|
|
7
|
+
data.tar.gz: edc78bd52329da3e8f8038146252669e72231527b7423e806d995e5f96f42e241931ebb93b3170dab5c68506c4a4a11e5ce293f23ce12ab15c005c43fd92e3aa
|
data/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Robots
|
|
2
|
+
Get robots.txt information from a site.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
```ruby
|
|
7
|
+
gem install Robots-txt
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bundle add Robots-txt
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gem install Robots-txt
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
require './lib/robots'
|
|
24
|
+
|
|
25
|
+
u = Robots::Url.new('https://www.ebay.com')
|
|
26
|
+
u.allow
|
|
27
|
+
u.disallow
|
|
28
|
+
u.disallow_removed
|
|
29
|
+
u.allow_removed
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Contributing
|
|
33
|
+
|
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/Robots.
|
data/Rakefile
ADDED
data/lib/Robots.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require_relative 'Robots/version'
|
|
5
|
+
|
|
6
|
+
module Robots
|
|
7
|
+
class Url
|
|
8
|
+
attr_reader :url
|
|
9
|
+
|
|
10
|
+
def initialize(url)
|
|
11
|
+
@url = url
|
|
12
|
+
puts "kkk"
|
|
13
|
+
uri = URI(File.join(@url, 'robots.txt'))
|
|
14
|
+
@response = Net::HTTP.get_response(uri).body.split("\n").map(&:to_s)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def disallow
|
|
18
|
+
for disallow in @response
|
|
19
|
+
puts disallow
|
|
20
|
+
if /(Disallow:)/ =~ disallow
|
|
21
|
+
puts "#{disallow}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def allow
|
|
27
|
+
for allow in @response
|
|
28
|
+
if /(Allow:)/ =~ allow
|
|
29
|
+
puts "#{allow}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def allow_removed
|
|
35
|
+
for allow in @response
|
|
36
|
+
if /(Allow:)/ =~ allow
|
|
37
|
+
puts "#{allow.gsub('Allow: ', '')}"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def disallow_removed
|
|
43
|
+
for disallow in @response
|
|
44
|
+
if /(Disallow:)/ =~ disallow
|
|
45
|
+
puts "#{disallow.gsub('Disallow: ', '')}"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/sig/Robots.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ReadRobotstxt
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Michael-Meade
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-10-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Read Robots.txt files
|
|
14
|
+
email:
|
|
15
|
+
- nowaylol@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- README.md
|
|
21
|
+
- Rakefile
|
|
22
|
+
- lib/Robots.rb
|
|
23
|
+
- lib/Robots/version.rb
|
|
24
|
+
- sig/Robots.rbs
|
|
25
|
+
homepage:
|
|
26
|
+
licenses: []
|
|
27
|
+
metadata: {}
|
|
28
|
+
post_install_message:
|
|
29
|
+
rdoc_options: []
|
|
30
|
+
require_paths:
|
|
31
|
+
- lib
|
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: 3.2.0
|
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
requirements: []
|
|
43
|
+
rubygems_version: 3.4.20
|
|
44
|
+
signing_key:
|
|
45
|
+
specification_version: 4
|
|
46
|
+
summary: Read Robots.txt files
|
|
47
|
+
test_files: []
|