Skip to content

Commit

Permalink
Merge pull request #29 from iPromKnight/feature/dmm-hashlists-v2
Browse files Browse the repository at this point in the history
fix: handle v2 hashlists
  • Loading branch information
iPromKnight authored Nov 11, 2024
2 parents f9f95ad + e882e9f commit 860c069
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Zilean.DmmScraper/Features/Dmm/DmmPageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public async Task<List<ExtractedDmmEntry>> ProcessPageAsync(string filePath, str
using var memoryStream = new MemoryStream(byteArray, 0, byteCount);
using var json = await JsonDocument.ParseAsync(memoryStream, cancellationToken: cancellationToken);

var torrents = json.RootElement.EnumerateArray().Select(ParsePageContent).OfType<ExtractedDmmEntry>().ToList();
var torrents = json.RootElement.TryGetProperty("torrents", out var torrentsElement) && torrentsElement.ValueKind == JsonValueKind.Array
? torrentsElement.EnumerateArray().Select(ParsePageContent).OfType<ExtractedDmmEntry>().ToList()
: json.RootElement.EnumerateArray().Select(ParsePageContent).OfType<ExtractedDmmEntry>().ToList();

if (torrents.Count == 0)
{
Expand Down

0 comments on commit 860c069

Please sign in to comment.