16 lines
389 B
Ruby
16 lines
389 B
Ruby
module LinkChecker
|
|
UA = "Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0"
|
|
module_function def http(input)
|
|
response = Net::HTTP.get_response(URI.parse(input), {"User-Agent": UA})
|
|
# debugger
|
|
case response
|
|
when Net::HTTPSuccess
|
|
response.uri
|
|
when Net::HTTPRedirection
|
|
http(response[:location])
|
|
else
|
|
false
|
|
end
|
|
end
|
|
end
|
|
|