Weighted thermodynamic formalism and applications