Sha256: b0461ce490fcf6daf8aa9a89c613fbf533e6b9d0852e678d349a1a33e4d81484

Contents?: true

Size: 604 Bytes

Versions: 31

Compression:

Stored size: 604 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.instance
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

31 entries across 31 versions & 1 rubygems

Version Path
wmap-2.8.4 demos/filter_prime.rb
wmap-2.8.3 demos/filter_prime.rb
wmap-2.8.2 demos/filter_prime.rb
wmap-2.8.1 demos/filter_prime.rb
wmap-2.7.9 demos/filter_prime.rb
wmap-2.7.7 demos/filter_prime.rb
wmap-2.7.6 demos/filter_prime.rb
wmap-2.7.2 demos/filter_prime.rb
wmap-2.7.1 demos/filter_prime.rb
wmap-2.7.0 demos/filter_prime.rb
wmap-2.6.9 demos/filter_prime.rb
wmap-2.6.8 demos/filter_prime.rb
wmap-2.6.7 demos/filter_prime.rb
wmap-2.6.6 demos/filter_prime.rb
wmap-2.6.5 demos/filter_prime.rb
wmap-2.6.4 demos/filter_prime.rb
wmap-2.6.3 demos/filter_prime.rb
wmap-2.6.2 demos/filter_prime.rb
wmap-2.6.1 demos/filter_prime.rb
wmap-2.6.0 demos/filter_prime.rb