From bfbb2710b6d85fbd022b9abc6ecf42ac473abd6f Mon Sep 17 00:00:00 2001 From: aminosred25 <103501905+aminosred25@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:33:57 +0200 Subject: [PATCH] Try to handle response body as a JSON first before handling it as a plain text --- lib/app_sources/html.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index 22f5f3d..15874ad 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -146,10 +146,7 @@ Future>> grabLinksCommon( .map((e) => MapEntry(ensureAbsoluteUrl(e.key, reqUrl), e.value)) .toList(); if (allLinks.isEmpty || matchLinksOutsideATags) { - allLinks = getLinksInLines(rawBody); - } - if (allLinks.isEmpty) { - // Getting desperate + // Decode the body if the response is a JSON try { var jsonStrings = collectAllStringsFromJSONObject(jsonDecode(rawBody)); allLinks = getLinksInLines(jsonStrings.join('\n')); @@ -163,7 +160,7 @@ Future>> grabLinksCommon( ); } } catch (e) { - // + allLinks = getLinksInLines(rawBody); } } List> links = [];