mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
removed trakt references, added user agent to tvdb requests
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Xml.Linq;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
using TVDBSharp.Models.Enums;
|
||||
|
||||
namespace TVDBSharp.Models.DAO
|
||||
@@ -13,6 +15,9 @@ namespace TVDBSharp.Models.DAO
|
||||
public string ApiKey { get; set; }
|
||||
private const string BaseUrl = "http://thetvdb.com";
|
||||
|
||||
|
||||
private static HttpClient httpClient = new HttpClient(NzbDroneLogger.GetLogger(typeof(DataProvider)));
|
||||
|
||||
public XDocument GetShow(int showID)
|
||||
{
|
||||
return GetXDocumentFromUrl(string.Format("{0}/api/{1}/series/{2}/all/", BaseUrl, ApiKey, showID));
|
||||
@@ -35,9 +40,15 @@ namespace TVDBSharp.Models.DAO
|
||||
|
||||
private static XDocument GetXDocumentFromUrl(string url)
|
||||
{
|
||||
using (var web = new WebClient())
|
||||
using (var memoryStream = new MemoryStream(web.DownloadData(url)))
|
||||
return XDocument.Load(memoryStream);
|
||||
|
||||
var request = new HttpRequest(url, new HttpAccept("application/xml"));
|
||||
|
||||
|
||||
|
||||
var response = httpClient.Get(request);
|
||||
|
||||
return XDocument.Parse(response.Content);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user