mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #967 from erri120/mediafire-direct-links-fix
Fixed MediafireDownloader not handling direct links
This commit is contained in:
commit
7567bd5567
@ -1,5 +1,8 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - next
|
||||
* Fixed Mediafire Downloader not handling direct links
|
||||
|
||||
#### Version - 2.1.4.0 - **
|
||||
* List ingestion now supports compression and processes on a background threaded
|
||||
* Support for validation of unlisted modlists
|
||||
|
@ -50,11 +50,21 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
private async Task<HTTPDownloader.State?> Resolve()
|
||||
{
|
||||
var client = new Wabbajack.Lib.Http.Client();
|
||||
var body = await client.GetHtmlAsync(Url);
|
||||
var node = body.DocumentNode.DescendantsAndSelf().First(d => d.HasClass("input") && d.HasClass("popsok") &&
|
||||
d.GetAttributeValue("aria-label", "") == "Download file");
|
||||
return new HTTPDownloader.State(node.GetAttributeValue("href", "not-found"));
|
||||
var client = new Http.Client();
|
||||
var result = await client.GetAsync(Url, HttpCompletionOption.ResponseHeadersRead);
|
||||
if (!result.IsSuccessStatusCode)
|
||||
return null;
|
||||
|
||||
if (result.Content.Headers.ContentType.MediaType.StartsWith("text/html",
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var body = await client.GetHtmlAsync(Url);
|
||||
var node = body.DocumentNode.DescendantsAndSelf().First(d => d.HasClass("input") && d.HasClass("popsok") &&
|
||||
d.GetAttributeValue("aria-label", "") == "Download file");
|
||||
return new HTTPDownloader.State(node.GetAttributeValue("href", "not-found"));
|
||||
}
|
||||
|
||||
return new HTTPDownloader.State(Url);
|
||||
}
|
||||
|
||||
public override IDownloader GetDownloader()
|
||||
|
Loading…
Reference in New Issue
Block a user