Files
telegram-bot/modules/Destiny2.WhereIsXur/Provider/XurWiki.cs
2020-03-09 20:12:03 +04:00

28 lines
718 B
C#

using System.Threading.Tasks;
using Fizzler.Systems.HtmlAgilityPack;
using HtmlAgilityPack;
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider
{
public class XurWiki : IXurPlaceProvider
{
public async Task<string> GetPlaceAsync()
{
var web = new HtmlWeb();
var document = await web.LoadFromWebAsync("https://xur.wiki");
var place = document.DocumentNode.QuerySelector(".location_name");
if (place != null)
{
return place.InnerText.Trim();
}
return "";
}
public string GetPlace()
{
return GetPlaceAsync().GetAwaiter().GetResult();
}
}
}