2015-07-07 17:11:11 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net;
|
2017-09-03 13:46:25 +01:00
|
|
|
|
using System.Text;
|
2015-07-07 17:11:11 +01:00
|
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Local
|
|
|
|
|
{
|
|
|
|
|
internal class ExtendedWebClient : WebClient
|
|
|
|
|
{
|
|
|
|
|
public int Timeout { get; set; }
|
|
|
|
|
|
|
|
|
|
public ExtendedWebClient()
|
|
|
|
|
{
|
2016-09-30 11:16:36 +01:00
|
|
|
|
// TODO Remove once SSL Issues are resolved #115
|
|
|
|
|
ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true;
|
2017-09-03 13:46:25 +01:00
|
|
|
|
Encoding = Encoding.UTF8;
|
2015-07-07 17:11:11 +01:00
|
|
|
|
Timeout = 2000;
|
|
|
|
|
Headers.Add("Origin", "https://embed.spotify.com");
|
|
|
|
|
Headers.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override WebRequest GetWebRequest(Uri address)
|
|
|
|
|
{
|
|
|
|
|
WebRequest webRequest = base.GetWebRequest(address);
|
|
|
|
|
if (webRequest != null)
|
|
|
|
|
webRequest.Timeout = Timeout;
|
|
|
|
|
return webRequest;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|