Cosmology and extragalactic astronomy