2020-08-11 14:01:26 +02:00
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
import 'package:html/parser.dart';
|
|
|
|
|
|
|
|
Future<dynamic> getNewRelease(String page) async {
|
|
|
|
try {
|
|
|
|
List images = <String>[];
|
|
|
|
List links = <String>[];
|
|
|
|
List titles = <String>[];
|
|
|
|
final response = await http
|
2020-08-29 18:17:28 +02:00
|
|
|
.get('https://neonime.vip/episode/page/$page/')
|
2020-08-11 14:01:26 +02:00
|
|
|
.catchError((e) {
|
|
|
|
print(e);
|
|
|
|
});
|
|
|
|
var document = parse(response.body);
|
|
|
|
var table = document.getElementsByClassName('list')[0];
|
|
|
|
var top = table.getElementsByClassName('imagen-td');
|
|
|
|
for (var image in top) {
|
|
|
|
images.add(image.getElementsByTagName('img')[0].attributes['data-src']);
|
|
|
|
}
|
|
|
|
for (var link in top) {
|
|
|
|
links.add(link.getElementsByTagName('a')[0].attributes['href']);
|
|
|
|
}
|
|
|
|
var bottom = table.getElementsByClassName('bb');
|
|
|
|
for (var title in bottom) {
|
|
|
|
if (title.getElementsByTagName('a').isNotEmpty) {
|
|
|
|
titles.add(title.getElementsByTagName('a')[0].text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var data = <dynamic>[];
|
|
|
|
for (var i = 0; i < links.length; i++) {
|
|
|
|
data.add({
|
|
|
|
'image': images[i].replaceAll(new RegExp(r'\/w(\d\d\d)\/'), '/original/'),
|
|
|
|
'link': links[i],
|
|
|
|
'title': titles[i].replaceAll(' Subtitle Indonesia ','')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
} catch (e) {
|
|
|
|
print(e);
|
|
|
|
throw FormatException('ntah lah');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<dynamic> getEpisodeDetail(String url) async {
|
|
|
|
try {
|
|
|
|
List<String> streamUrls = <String>[];
|
2020-09-07 20:15:07 +02:00
|
|
|
List<String> streamNames = <String>[];
|
2020-08-11 14:01:26 +02:00
|
|
|
List<String> downloadUrls = <String>[];
|
2020-09-07 18:39:18 +02:00
|
|
|
List<String> description = <String>[];
|
2020-08-11 14:01:26 +02:00
|
|
|
final response = await http.get(url);
|
|
|
|
var document = parse(response.body);
|
|
|
|
document.getElementsByTagName('iframe').forEach((x) {
|
|
|
|
streamUrls.add(x.attributes['data-src']);
|
|
|
|
});
|
2020-09-07 20:15:07 +02:00
|
|
|
document.getElementsByClassName('change-player').forEach((x) {
|
|
|
|
streamNames.add(x.text);
|
|
|
|
});
|
2020-08-11 14:01:26 +02:00
|
|
|
var downloadBox = document.getElementsByClassName('linkstv')[0];
|
|
|
|
downloadBox.getElementsByTagName('a').forEach((x) {
|
|
|
|
downloadUrls.add(x.attributes['href']);
|
|
|
|
});
|
|
|
|
var imageBox = document.getElementsByClassName('imagen')[0];
|
|
|
|
var image = imageBox.getElementsByTagName('img')[0].attributes['data-src'];
|
|
|
|
var detailUrl = imageBox.getElementsByTagName('a')[0].attributes['href'];
|
|
|
|
var contentBox = document.getElementsByClassName('contenidotv')[0];
|
|
|
|
var title = contentBox.getElementsByTagName('h2')[0].text;
|
|
|
|
contentBox.getElementsByTagName('p').forEach((x) {
|
2020-09-07 18:39:18 +02:00
|
|
|
description.add(x.text);
|
2020-08-11 14:01:26 +02:00
|
|
|
});
|
2020-09-07 20:15:07 +02:00
|
|
|
if (streamUrls.length != streamNames.length) {
|
|
|
|
streamNames = streamNames.sublist(0, streamUrls.length);
|
|
|
|
}
|
2020-08-11 14:01:26 +02:00
|
|
|
var rmv = title.split(' Episode ');
|
|
|
|
title = rmv[0].replaceAll('Sinopsis dari anime ', '');
|
|
|
|
final data = {
|
|
|
|
'title': title,
|
2020-09-07 18:39:18 +02:00
|
|
|
'description': description.join('\n\n'),
|
2020-08-11 14:01:26 +02:00
|
|
|
'image': image.replaceAll(new RegExp(r'\/w(\d\d\d)\/'), '/original/'),
|
|
|
|
'detail_url': detailUrl,
|
2020-09-07 20:15:07 +02:00
|
|
|
'stream_name': streamNames,
|
2020-08-11 14:01:26 +02:00
|
|
|
'stream_url': streamUrls,
|
|
|
|
'download_url': downloadUrls
|
|
|
|
};
|
|
|
|
return data;
|
|
|
|
} catch (e) {
|
|
|
|
print(e);
|
|
|
|
throw FormatException('ntah lah');
|
|
|
|
}
|
|
|
|
}
|