Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
public-apis
Commits
4dfe2edb
Commit
4dfe2edb
authored
Jul 20, 2017
by
Dave Machado
Committed by
GitHub
Jul 20, 2017
Browse files
Add exempt array for links that do not permit bots
parent
1b9ab364
Changes
1
Hide whitespace changes
Inline
Side-by-side
build/validate_links.rb
View file @
4dfe2edb
...
...
@@ -3,6 +3,7 @@ require 'httparty'
require
'ruby-progressbar'
require
'uri'
allowed_codes
=
[
200
,
302
,
403
,
429
]
allowed_links
=
[
"https://www.yelp.com/developers/documentation/v3"
]
args
=
ARGV
filename
=
args
[
0
]
contents
=
File
.
open
(
filename
,
'rb'
)
{
|
f
|
f
.
read
}
...
...
@@ -33,6 +34,9 @@ progressbar = ProgressBar.create(:total => total)
links
.
each
do
|
link
|
begin
count
+=
1
if
allowed_links
.
include?
(
link
)
next
end
res
=
HTTParty
.
get
(
link
,
timeout:
10
)
if
res
.
code
.
nil?
fails
.
push
(
"(NIL):
#{
link
}
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment