parsePhrasePageData function

PhrasePageScrapeResult parsePhrasePageData(
  1. String pageHtml,
  2. String query
)

Parses a jisho word search page to an object

Implementation

PhrasePageScrapeResult parsePhrasePageData(String pageHtml, String query) {
  final document = parse(pageHtml);

  if (!_resultWasFound(document)) {
    return PhrasePageScrapeResult(found: false, query: query);
  }

  final data = _getMeaningsOtherFormsAndNotes(query, document);

  return PhrasePageScrapeResult(
    found: true,
    query: query,
    data: data,
  );
}