2019-12-08 17:00:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-03-04 12:10:49 +00:00
|
|
|
|
using HtmlAgilityPack;
|
2020-03-26 23:02:15 +00:00
|
|
|
|
using MessagePack;
|
2019-12-08 17:00:22 +00:00
|
|
|
|
using Wabbajack.Common;
|
2019-12-26 23:26:53 +00:00
|
|
|
|
using Wabbajack.Lib.WebAutomation;
|
2019-12-08 17:00:22 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Lib.Downloaders
|
|
|
|
|
{
|
2020-01-06 00:21:05 +00:00
|
|
|
|
public class LoversLabDownloader : AbstractIPS4Downloader<LoversLabDownloader, LoversLabDownloader.State>
|
2019-12-08 17:00:22 +00:00
|
|
|
|
{
|
2019-12-20 20:51:10 +00:00
|
|
|
|
#region INeedsDownload
|
2020-01-05 05:38:08 +00:00
|
|
|
|
public override string SiteName => "Lovers Lab";
|
2020-01-06 00:21:05 +00:00
|
|
|
|
public override Uri SiteURL => new Uri("https://www.loverslab.com");
|
2020-01-05 05:38:08 +00:00
|
|
|
|
public override Uri IconUri => new Uri("https://www.loverslab.com/favicon.ico");
|
2019-12-20 20:51:10 +00:00
|
|
|
|
#endregion
|
2020-01-05 05:38:08 +00:00
|
|
|
|
public LoversLabDownloader() : base(new Uri("https://www.loverslab.com/login"),
|
2020-01-06 00:21:05 +00:00
|
|
|
|
"loverslabcookies", "loverslab.com")
|
2019-12-20 20:51:10 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2020-01-05 05:38:08 +00:00
|
|
|
|
protected override async Task WhileWaiting(IWebDriver browser)
|
2019-12-08 17:00:22 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-01-05 05:38:08 +00:00
|
|
|
|
await browser.EvaluateJavaScript(
|
|
|
|
|
"document.querySelectorAll(\".ll_adblock\").forEach(function (itm) { itm.innerHTML = \"\";});");
|
2019-12-08 17:00:22 +00:00
|
|
|
|
}
|
2020-01-05 05:38:08 +00:00
|
|
|
|
catch (Exception ex)
|
2019-12-08 17:00:22 +00:00
|
|
|
|
{
|
2020-01-05 05:38:08 +00:00
|
|
|
|
Utils.Error(ex);
|
2019-12-08 17:00:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-04 12:10:49 +00:00
|
|
|
|
|
2020-01-06 00:21:05 +00:00
|
|
|
|
public class State : State<LoversLabDownloader>
|
2019-12-08 17:00:22 +00:00
|
|
|
|
{
|
2020-03-26 23:02:15 +00:00
|
|
|
|
[IgnoreMember]
|
2020-03-04 12:10:49 +00:00
|
|
|
|
public override bool IsNSFW => true;
|
|
|
|
|
|
|
|
|
|
public override async Task<bool> LoadMetaData()
|
|
|
|
|
{
|
|
|
|
|
var html = await Downloader.AuthedClient.GetStringAsync(URL);
|
|
|
|
|
var doc = new HtmlDocument();
|
|
|
|
|
doc.LoadHtml(html);
|
|
|
|
|
var node = doc.DocumentNode;
|
|
|
|
|
Name = node.SelectNodes("//h1[@class='ipsType_pageTitle ipsContained_container']/span")?.First().InnerHtml;
|
|
|
|
|
Author = node
|
|
|
|
|
.SelectNodes(
|
|
|
|
|
"//div[@class='ipsBox_alt']/div[@class='ipsPhotoPanel ipsPhotoPanel_tiny ipsClearfix ipsSpacer_bottom']/div/p[@class='ipsType_reset ipsType_large ipsType_blendLinks']/a")
|
|
|
|
|
?.First().InnerHtml;
|
|
|
|
|
Version = node.SelectNodes("//section/h2[@class='ipsType_sectionHead']/span[@data-role='versionTitle']")
|
|
|
|
|
?
|
|
|
|
|
.First().InnerHtml;
|
|
|
|
|
ImageURL = node
|
|
|
|
|
.SelectNodes(
|
|
|
|
|
"//div[@class='ipsBox ipsSpacer_top ipsSpacer_double']/section/div[@class='ipsPad ipsAreaBackground']/div[@class='ipsCarousel ipsClearfix']/div[@class='ipsCarousel_inner']/ul[@class='cDownloadsCarousel ipsClearfix']/li[@class='ipsCarousel_item ipsAreaBackground_reset ipsPad_half']/span[@class='ipsThumb ipsThumb_medium ipsThumb_bg ipsCursor_pointer']")
|
|
|
|
|
?.First().GetAttributeValue("data-fullurl", "none");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2019-12-08 17:00:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|