mirror of
https://github.com/public-apis/public-apis.git
synced 2025-05-10 15:46:48 +02:00
Add exempt array for links that do not permit bots
This commit is contained in:
parent
1b9ab3649b
commit
4dfe2edb58
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ require 'httparty'
|
||||||
require 'ruby-progressbar'
|
require 'ruby-progressbar'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
allowed_codes = [200, 302, 403, 429]
|
allowed_codes = [200, 302, 403, 429]
|
||||||
|
allowed_links = ["https://www.yelp.com/developers/documentation/v3"]
|
||||||
args = ARGV
|
args = ARGV
|
||||||
filename = args[0]
|
filename = args[0]
|
||||||
contents = File.open(filename, 'rb') { |f| f.read }
|
contents = File.open(filename, 'rb') { |f| f.read }
|
||||||
|
@ -33,6 +34,9 @@ progressbar = ProgressBar.create(:total => total)
|
||||||
links.each do |link|
|
links.each do |link|
|
||||||
begin
|
begin
|
||||||
count += 1
|
count += 1
|
||||||
|
if allowed_links.include?(link)
|
||||||
|
next
|
||||||
|
end
|
||||||
res = HTTParty.get(link, timeout: 10)
|
res = HTTParty.get(link, timeout: 10)
|
||||||
if res.code.nil?
|
if res.code.nil?
|
||||||
fails.push("(NIL): #{link}")
|
fails.push("(NIL): #{link}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue