mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: video push
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -77,10 +77,8 @@ class PiliScheme {
|
|||||||
pathQuery = 'AV$pathQuery';
|
pathQuery = 'AV$pathQuery';
|
||||||
}
|
}
|
||||||
Map map = IdUtils.matchAvorBv(input: pathQuery);
|
Map map = IdUtils.matchAvorBv(input: pathQuery);
|
||||||
if (map.containsKey('AV')) {
|
if (map.isNotEmpty) {
|
||||||
videoPush(map['AV'], null);
|
videoPush(map['AV'], map['BV']);
|
||||||
} else if (map.containsKey('BV')) {
|
|
||||||
videoPush(null, map['BV']);
|
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('投稿匹配失败');
|
SmartDialog.showToast('投稿匹配失败');
|
||||||
}
|
}
|
||||||
@@ -321,10 +319,8 @@ class PiliScheme {
|
|||||||
if (avRegex.hasMatch(lastPathSegment)) {
|
if (avRegex.hasMatch(lastPathSegment)) {
|
||||||
final Map<String, dynamic> map =
|
final Map<String, dynamic> map =
|
||||||
IdUtils.matchAvorBv(input: lastPathSegment);
|
IdUtils.matchAvorBv(input: lastPathSegment);
|
||||||
if (map.containsKey('AV')) {
|
if (map.isNotEmpty) {
|
||||||
videoPush(map['AV']! as int, null);
|
videoPush(map['AV'], map['BV']);
|
||||||
} else if (map.containsKey('BV')) {
|
|
||||||
videoPush(null, map['BV'] as String);
|
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('投稿匹配失败');
|
SmartDialog.showToast('投稿匹配失败');
|
||||||
}
|
}
|
||||||
@@ -366,10 +362,8 @@ class PiliScheme {
|
|||||||
case 'video':
|
case 'video':
|
||||||
debugPrint('投稿');
|
debugPrint('投稿');
|
||||||
final Map<String, dynamic> map = IdUtils.matchAvorBv(input: path);
|
final Map<String, dynamic> map = IdUtils.matchAvorBv(input: path);
|
||||||
if (map.containsKey('AV')) {
|
if (map.isNotEmpty) {
|
||||||
videoPush(map['AV']! as int, null);
|
videoPush(map['AV'], map['BV']);
|
||||||
} else if (map.containsKey('BV')) {
|
|
||||||
videoPush(null, map['BV'] as String);
|
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('投稿匹配失败');
|
SmartDialog.showToast('投稿匹配失败');
|
||||||
}
|
}
|
||||||
@@ -396,11 +390,9 @@ class PiliScheme {
|
|||||||
arguments: {'face': ''});
|
arguments: {'face': ''});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var res = IdUtils.matchAvorBv(input: area.split('?').first);
|
Map map = IdUtils.matchAvorBv(input: area.split('?').first);
|
||||||
if (res.containsKey('AV')) {
|
if (map.isNotEmpty) {
|
||||||
videoPush(res['AV']! as int, null);
|
videoPush(map['AV'], map['BV']);
|
||||||
} else if (res.containsKey('BV')) {
|
|
||||||
videoPush(null, res['BV'] as String);
|
|
||||||
} else {
|
} else {
|
||||||
// SmartDialog.showToast('未知路径或匹配错误:$value,先采用浏览器打开');
|
// SmartDialog.showToast('未知路径或匹配错误:$value,先采用浏览器打开');
|
||||||
Utils.handleWebview(value.toString());
|
Utils.handleWebview(value.toString());
|
||||||
|
|||||||
@@ -68,11 +68,10 @@ class IdUtils {
|
|||||||
if (input == null || input.isEmpty) {
|
if (input == null || input.isEmpty) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
final RegExp bvRegex =
|
final RegExp bvRegex = RegExp(r'bv([0-9A-Za-z]{10})', caseSensitive: false);
|
||||||
RegExp(r'^bv([0-9A-Za-z]{10})', caseSensitive: false);
|
|
||||||
String? bvid = bvRegex.firstMatch(input)?.group(1);
|
String? bvid = bvRegex.firstMatch(input)?.group(1);
|
||||||
|
|
||||||
late final RegExp avRegex = RegExp(r'^av(\d+)', caseSensitive: false);
|
late final RegExp avRegex = RegExp(r'av(\d+)', caseSensitive: false);
|
||||||
late String? aid = avRegex.firstMatch(input)?.group(1);
|
late String? aid = avRegex.firstMatch(input)?.group(1);
|
||||||
|
|
||||||
if (bvid != null) {
|
if (bvid != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user