public Ivoox IvooxClient() { using (HttpClient AruppiClient = new HttpClient()) { XmlSerializer serializer = new XmlSerializer(typeof(Ivoox)); string url = "https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml"; AruppiClient.BaseAddress = new Uri(url); StringBuilder path = new StringBuilder(url); Ivoox respuesta = new Ivoox(); using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, new Uri(path.ToString()))) { try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpResponseMessage response = AruppiClient.GetAsync(url).Result; string jsonString = response.Content.ReadAsStringAsync().Result; if (response.IsSuccessStatusCode && response.StatusCode.Equals(System.Net.HttpStatusCode.OK)) { using (TextReader reader = new StringReader(jsonString)) { respuesta = (Ivoox)serializer.Deserialize(reader); } } else { throw new Exception(); } } catch (Exception ex) { throw ex; } return(respuesta); } } }
public Ivoox Ivoox() { Ivoox ivox = _client.IvooxClient(); return(ivox); }