The Dynamics of Polarized Beliefs in Networks Governed by Viral Diffusion and Media Influence