Add the extra snippets to the source excerpts.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
Adam Treat 2024-07-25 19:40:18 -04:00
parent 1c9911a4ac
commit c78c95ab42

View File

@ -101,8 +101,17 @@ static QPair<QString, QList<SourceExcerpt>> cleanBraveResponse(const QByteArray&
}
}
QStringList textKeys = {"description", "extra_snippets"};
QJsonObject textObj;
for (const auto& key : textKeys) {
if (resultObj.contains(key)) {
textObj.insert(key, resultObj[key]);
}
}
QJsonDocument textObjDoc(textObj);
info.date = resultObj["date"].toString();
info.text = resultObj["description"].toString(); // fixme
info.text = textObjDoc.toJson(QJsonDocument::Indented);
info.url = resultObj["url"].toString();
QJsonObject meta_url = resultObj["meta_url"].toObject();
info.favicon = meta_url["favicon"].toString();