Did you mean `i = p[0].split('/')[0]`? This currently isn't working when a domain is specified, e.g. domain.com:123.