Fix blank space in description

This commit is contained in:
Moe Poi ~ 2020-09-07 23:39:18 +07:00
parent 9a729ee937
commit d70ef47a41

View file

@ -45,6 +45,7 @@ Future<dynamic> getEpisodeDetail(String url) async {
try { try {
List<String> streamUrls = <String>[]; List<String> streamUrls = <String>[];
List<String> downloadUrls = <String>[]; List<String> downloadUrls = <String>[];
List<String> description = <String>[];
final response = await http.get(url); final response = await http.get(url);
var document = parse(response.body); var document = parse(response.body);
document.getElementsByTagName('iframe').forEach((x) { document.getElementsByTagName('iframe').forEach((x) {
@ -59,15 +60,14 @@ Future<dynamic> getEpisodeDetail(String url) async {
var detailUrl = imageBox.getElementsByTagName('a')[0].attributes['href']; var detailUrl = imageBox.getElementsByTagName('a')[0].attributes['href'];
var contentBox = document.getElementsByClassName('contenidotv')[0]; var contentBox = document.getElementsByClassName('contenidotv')[0];
var title = contentBox.getElementsByTagName('h2')[0].text; var title = contentBox.getElementsByTagName('h2')[0].text;
var description = '';
contentBox.getElementsByTagName('p').forEach((x) { contentBox.getElementsByTagName('p').forEach((x) {
description += x.text + '\n\n'; description.add(x.text);
}); });
var rmv = title.split(' Episode '); var rmv = title.split(' Episode ');
title = rmv[0].replaceAll('Sinopsis dari anime ', ''); title = rmv[0].replaceAll('Sinopsis dari anime ', '');
final data = { final data = {
'title': title, 'title': title,
'description': description, 'description': description.join('\n\n'),
'image': image.replaceAll(new RegExp(r'\/w(\d\d\d)\/'), '/original/'), 'image': image.replaceAll(new RegExp(r'\/w(\d\d\d)\/'), '/original/'),
'detail_url': detailUrl, 'detail_url': detailUrl,
'stream_url': streamUrls, 'stream_url': streamUrls,