Skip to content

Commit

Permalink
- Do not parse HTML when no needed
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaBear84 committed Jul 31, 2022
1 parent 88d3b96 commit 6c4c46c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/OpenDirectoryDownloader/DirectoryParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ public static async Task<WebDirectory> ParseHtml(WebDirectory webDirectory, stri

try
{
IHtmlDocument htmlDocument = await HtmlParser.ParseDocumentAsync(html);

if (webDirectory.Uri.Host == "ipfs.io" || webDirectory.Uri.Host == "gateway.ipfs.io")
{
return ParseIpfsDirectoryListing(baseUrl, parsedWebDirectory, htmlDocument, checkParents);
}

if (webDirectory.Uri.Host == Constants.BlitzfilesTechDomain)
{
return await BlitzfilesTechParser.ParseIndex(httpClient, webDirectory);
Expand All @@ -92,6 +85,13 @@ public static async Task<WebDirectory> ParseHtml(WebDirectory webDirectory, stri
return await MediafireParser.ParseIndex(httpClient, webDirectory);
}

IHtmlDocument htmlDocument = await HtmlParser.ParseDocumentAsync(html);

if (webDirectory.Uri.Host == "ipfs.io" || webDirectory.Uri.Host == "gateway.ipfs.io")
{
return ParseIpfsDirectoryListing(baseUrl, parsedWebDirectory, htmlDocument, checkParents);
}

if (httpClient is not null && !OpenDirectoryIndexer.Session.Parameters.ContainsKey(Constants.GoogleDriveIndexType))
{
string googleDriveIndexType = null;
Expand Down

0 comments on commit 6c4c46c

Please sign in to comment.