unofficial_jisho_api_dart/example/parser/parse_example_page.dart

17 lines
630 B
Dart
Raw Normal View History

2020-06-25 23:01:38 +02:00
import 'dart:convert';
2020-06-26 01:59:23 +02:00
import 'package:http/http.dart' as http;
2020-06-25 23:01:38 +02:00
import 'package:unofficial_jisho_api/parser.dart' as jisho_parser;
2020-06-26 01:59:23 +02:00
final JsonEncoder encoder = JsonEncoder.withIndent(' ');
2020-06-25 23:01:38 +02:00
2020-06-26 01:59:23 +02:00
const String searchExample = '保護者';
final String searchURI = jisho_parser.uriForExampleSearch(searchExample);
2020-06-25 23:01:38 +02:00
void main() async {
2020-06-26 01:59:23 +02:00
await http.get(searchURI).then((result) {
final parsedResult = jisho_parser.parseExamplePageData(result.body, searchExample);
2020-06-25 23:01:38 +02:00
print('English: ${parsedResult.results[0].english}');
print('Kanji ${parsedResult.results[0].kanji}');
print('Kana: ${parsedResult.results[0].kana}');
});
}