Future _detail() async {
setState(() {
getString('https://wx.vzan.com/live/PlayPage?tpid=${res.url}');
}
});
}
void getString(String url) async {
print("get: $url");
Response response;
try {
response = await Dio().get<String>(url);
getVideoUrl(response.toString());
} on DioError catch (e) {
print('get錯誤:$e');
}
getVideoUrl(response.toString());
}
void getVideoUrl(String html) {
var htmlArr = html.split('\n');
// print(htmlArr);
htmlArr.forEach((element) {
if(element.indexOf('m3u8?time') > -1){
vzanVideo = element.replaceAll('var url = ', '').replaceAll('"', '').replaceAll(';', '');
print(vzanVideo);
}
});
}