Add protocol detection to get_avatar