Untitled
unknown
plain_text
a year ago
2.4 kB
5
Indexable
Never
import 'package:flutter/material.dart'; import 'package:html/parser.dart' as parser; import 'package:html/dom.dart' as dom; import 'package:url_launcher/url_launcher.dart'; class VideoExtractor extends StatefulWidget { @override _VideoExtractorState createState() => _VideoExtractorState(); } class _VideoExtractorState extends State<VideoExtractor> { String videoUrl = ''; void extractVideoUrl(String html) { dom.Document document = parser.parse(html); dom.Element iframeElement = document.querySelector('.iframe > iframe'); String srcAttribute = iframeElement?.attributes['src']; if (srcAttribute != null) { setState(() { videoUrl = srcAttribute; }); } } @override void initState() { super.initState(); String html = "<p><br></p><div class=\"iframe\"><iframe src=\"https://panet.com/player?v=https://live1.panet.co.il/edge_abr/halaTV/playlist.m3u8\" frameborder=\"0\" width=\"100%\" height=\"380px\"></iframe></div><p><br></p><div class=\"iframe\"><br></div><p><br>وفقا الانباء الاولية المتوفرة فان الاصابات بحادثة الدهس متفاوتة .<br><span style=\"font-size: 1rem;\">نص \" ان نص نصن نصصنصنصن \".</span></p><p><span style=\"color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);\">ابابابا :\" اب \"</span><br>من جه \".</p><div class=\"summernote-image\"><img src=\"http://ipublish.panet.com//media/photos/2peja0fhhzyx/rg7k/2peja0fhhzyxrg7k.jpg\" width=\"450px\" style=\"margin-top: 2px; margin-bottom: 2px\"><br><span style=\"color: rgb(255, 0, 0); font-weight: bold;\">تصوير الحمراء\r\n</span><br class=\"Apple-interchange-newline\"></div><div class=\"summernote-image\"><br></div>"; extractVideoUrl(html); } void launchVideo() async { if (await canLaunch(videoUrl)) { await launch(videoUrl); } else { print('Failed to launch the video.'); } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Video Extractor'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( onPressed: launchVideo, child: Text('Play Video'), ), ], ), ), ); } }