Created
October 16, 2019 19:55
-
-
Save 7even/c1d84509fc5bbb7f95af938cc2d9bbc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'faraday' | |
def urls_valid?(file_path) | |
doc = Nokogiri::XML(File.read(file_path)) | |
urls = doc.css('loc').map { |loc| loc.children.first.text } | |
urls.all? do |url| | |
Faraday.head(url).status == 200 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment