require 'net/http'
require 'uri'
def get_url(uri)
redirect = Net::HTTP.get_response(uri)
if redirect.code == '302' then
# return redirect
str1 = URI.parse(redirect['location']).path
str2 = File.basename(str1)
str3 = str1.gsub(/#{str2}\//,"")
return str3.gsub(/[^0-9]/, "")
else
return '0'
end
end
def corect(uri)
threads = []
url_list = []
100.times do |l|
threads << Thread.new { url_list << get_url(uri) }
end
threads.each(&:join)
url_list.uniq!
return url_list.sort
end
target = "https://mangaplay.org/watch/?tour=/vol/"
ta_uri = URI.parse(target)
uniq_list = []
1000.times{
list = []
list << corect(ta_uri)
for v in list do
for vv in v do
if vv != '0' then
uniq_list << vv
end
end
end
uniq_list.uniq!
p uniq_list.length
}
p uniq_list
p uniq_list.length