opt: webview to video

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-08 22:56:43 +08:00
parent 9a3766e7b7
commit 7cfebcb6ed
7 changed files with 68 additions and 54 deletions

View File

@@ -221,7 +221,9 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
return NavigationActionPolicy.CANCEL;
}
} catch (_) {}
} else if (url.startsWith('http://m.bilibili.com/playlist/')) {
} else if (RegExp(
r'^(https?://)?((www|m).)?(bilibili|b23).(com|tv)/playlist')
.hasMatch(url)) {
try {
String? bvid =
RegExp(r'bvid=(BV[a-zA-Z\d]+)').firstMatch(url)?.group(1);
@@ -230,9 +232,10 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
return NavigationActionPolicy.CANCEL;
}
} catch (_) {}
} else {
} else if (url.startsWith('http').not) {
if (url.startsWith('bilibili://video/')) {
String? str = Uri.parse(url).pathSegments.getOrNull(0);
String? str =
navigationAction.request.url!.pathSegments.getOrNull(0);
Get.offAndToNamed(
'/searchResult',
parameters: {'keyword': str ?? ''},