Spotify.NET/SpotifyAPI/Local/ExtendedWebClient.cs

26 lines
713 B
C#
Raw Normal View History

using System;
using System.Net;
namespace SpotifyAPI.Local
{
internal class ExtendedWebClient : WebClient
{
public int Timeout { get; set; }
public ExtendedWebClient()
{
Timeout = 2000;
Proxy = null;
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;
}
}
}