mirror of
https://gitlab.com/moepoi/neonime-app.git
synced 2024-11-21 22:46:18 +01:00
Add select server on streaming but still buggy (WIP)
This commit is contained in:
parent
d70ef47a41
commit
04732cc962
2 changed files with 49 additions and 1 deletions
|
@ -58,6 +58,8 @@ class _EpisodeDetailState extends State<EpisodeDetail> {
|
||||||
return Text(error.toString());
|
return Text(error.toString());
|
||||||
},
|
},
|
||||||
renderSuccess: ({data}) {
|
renderSuccess: ({data}) {
|
||||||
|
var currentServer = data['stream_url'][0];
|
||||||
|
var currentServerName = data['stream_name'][0];
|
||||||
return Center(
|
return Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
|
@ -65,7 +67,7 @@ class _EpisodeDetailState extends State<EpisodeDetail> {
|
||||||
height: 200,
|
height: 200,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: InAppWebView(
|
child: InAppWebView(
|
||||||
initialUrl: data['stream_url'][0],
|
initialUrl: currentServer,
|
||||||
onWebViewCreated:
|
onWebViewCreated:
|
||||||
(InAppWebViewController controller) {
|
(InAppWebViewController controller) {
|
||||||
webView = controller;
|
webView = controller;
|
||||||
|
@ -76,6 +78,44 @@ class _EpisodeDetailState extends State<EpisodeDetail> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Card(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 3,
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
margin: EdgeInsets.all(10),
|
||||||
|
child: Text('Select Server', style: TextStyle(fontSize: 20),),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 3,
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
margin: EdgeInsets.all(10),
|
||||||
|
child: DropdownButton(
|
||||||
|
value: currentServerName,
|
||||||
|
onChanged: (newValue){
|
||||||
|
setState(() {
|
||||||
|
int index = data['stream_name'].indexOf(newValue);
|
||||||
|
currentServer = data['stream_url'][index];
|
||||||
|
currentServerName = data['stream_name'][index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: data['stream_name'].map<DropdownMenuItem<String>>((String value) {
|
||||||
|
return DropdownMenuItem<String>(
|
||||||
|
child: Text(value),
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
// child: Text('test'),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Card(
|
Card(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.all(10),
|
margin: EdgeInsets.all(10),
|
||||||
|
|
|
@ -44,12 +44,16 @@ Future<dynamic> getNewRelease(String page) async {
|
||||||
Future<dynamic> getEpisodeDetail(String url) async {
|
Future<dynamic> getEpisodeDetail(String url) async {
|
||||||
try {
|
try {
|
||||||
List<String> streamUrls = <String>[];
|
List<String> streamUrls = <String>[];
|
||||||
|
List<String> streamNames = <String>[];
|
||||||
List<String> downloadUrls = <String>[];
|
List<String> downloadUrls = <String>[];
|
||||||
List<String> description = <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) {
|
||||||
streamUrls.add(x.attributes['data-src']);
|
streamUrls.add(x.attributes['data-src']);
|
||||||
|
});
|
||||||
|
document.getElementsByClassName('change-player').forEach((x) {
|
||||||
|
streamNames.add(x.text);
|
||||||
});
|
});
|
||||||
var downloadBox = document.getElementsByClassName('linkstv')[0];
|
var downloadBox = document.getElementsByClassName('linkstv')[0];
|
||||||
downloadBox.getElementsByTagName('a').forEach((x) {
|
downloadBox.getElementsByTagName('a').forEach((x) {
|
||||||
|
@ -63,6 +67,9 @@ Future<dynamic> getEpisodeDetail(String url) async {
|
||||||
contentBox.getElementsByTagName('p').forEach((x) {
|
contentBox.getElementsByTagName('p').forEach((x) {
|
||||||
description.add(x.text);
|
description.add(x.text);
|
||||||
});
|
});
|
||||||
|
if (streamUrls.length != streamNames.length) {
|
||||||
|
streamNames = streamNames.sublist(0, streamUrls.length);
|
||||||
|
}
|
||||||
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 = {
|
||||||
|
@ -70,6 +77,7 @@ Future<dynamic> getEpisodeDetail(String url) async {
|
||||||
'description': description.join('\n\n'),
|
'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_name': streamNames,
|
||||||
'stream_url': streamUrls,
|
'stream_url': streamUrls,
|
||||||
'download_url': downloadUrls
|
'download_url': downloadUrls
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue