Sha256: f9de4b7a40d4a027de02b6dfa0f586c1fe1c00cb943ae0d14a87a5d6a89d73e8

Contents?: true

Size: 599 Bytes

Versions: 3

Compression:

Stored size: 599 Bytes

Contents

# Replace the embedded hostname within the url, based on the prime host table
# Usage: ruby filter_prime.rb [file_host]
require	"wmap"

puts "URL | Prime URL"
my_tracker=Wmap::HostTracker::PrimaryHost.new
f_urls = File.open(ARGV[0], 'r')
f_urls.each do |line|
	url=line.chomp
	if my_tracker.is_url?(url)
		host=my_tracker.url_2_host(url)
		ip=my_tracker.host_2_ip(host)
		if my_tracker.ip_known?(ip)
			p_host=my_tracker.local_ip_2_host(ip)
			url_new=url.sub(host,p_host)
		else
			url_new=url
		end
		puts "#{url} | #{url_new}"
	else
		puts "#{url} | #{url}"
	end
end
f_urls.close
my_tracker=nil 

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wmap-2.4.6 demos/filter_prime.rb
wmap-2.4.5 demos/filter_prime.rb
wmap-2.4.4 demos/filter_prime.rb