This single formula should do what you want...

=MID(SUBSTITUTE(LEFT(A1,LEN(A1)-(RIGHT(A1)="/")),"www.",""),IFERROR(FIND("://",A1)+3,1),999)