1
0
mirror of https://github.com/h7x4/unofficial_jisho_api_dart.git synced 2025-09-21 04:55:56 +02:00

Make parser export functions directly

This commit is contained in:
2020-06-26 00:20:58 +02:00
parent b58c439418
commit d6509e6392
9 changed files with 18 additions and 32 deletions

View File

@@ -6,6 +6,7 @@ import 'package:html/dom.dart';
final RegExp kanjiRegex = RegExp(r'[\u4e00-\u9faf\u3400-\u4dbf]');
/// Provides the URI for an example search
String uriForExampleSearch(String phrase) {
return '${SCRAPE_BASE_URI}${Uri.encodeComponent(phrase)}%23sentences';
}
@@ -107,6 +108,7 @@ ExampleResultData parseExampleDiv(Element div) {
return result;
}
/// Parses a jisho example sentence search page to an object
ExampleResults parseExamplePageData(String pageHtml, String phrase) {
final document = parse(pageHtml);
final divs = document.querySelectorAll('.sentence_content');