mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: seek from url
related #208 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
@@ -140,7 +141,7 @@ class SearchHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<int> ab2c({dynamic aid, dynamic bvid}) async {
|
static Future<int> ab2c({dynamic aid, dynamic bvid, int? part}) async {
|
||||||
Map<String, dynamic> data = {};
|
Map<String, dynamic> data = {};
|
||||||
if (aid != null) {
|
if (aid != null) {
|
||||||
data['aid'] = aid;
|
data['aid'] = aid;
|
||||||
@@ -150,7 +151,10 @@ class SearchHttp {
|
|||||||
final dynamic res = await Request()
|
final dynamic res = await Request()
|
||||||
.get(Api.ab2c, queryParameters: <String, dynamic>{...data});
|
.get(Api.ab2c, queryParameters: <String, dynamic>{...data});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return res.data['data'].first['cid'];
|
return part != null
|
||||||
|
? ((res.data['data'] as List).getOrNull(part - 1)?['cid'] ??
|
||||||
|
res.data['data'].first['cid'])
|
||||||
|
: res.data['data'].first['cid'];
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast("ab2c error: ${res.data['message']}");
|
SmartDialog.showToast("ab2c error: ${res.data['message']}");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -453,10 +453,13 @@ class PiliScheme {
|
|||||||
debugPrint('投稿');
|
debugPrint('投稿');
|
||||||
final Map<String, dynamic> map = IdUtils.matchAvorBv(input: path);
|
final Map<String, dynamic> map = IdUtils.matchAvorBv(input: path);
|
||||||
if (map.isNotEmpty) {
|
if (map.isNotEmpty) {
|
||||||
|
final queryParameters = uri.queryParameters;
|
||||||
videoPush(
|
videoPush(
|
||||||
map['AV'],
|
map['AV'],
|
||||||
map['BV'],
|
map['BV'],
|
||||||
off: off,
|
off: off,
|
||||||
|
progress: queryParameters['dm_progress'],
|
||||||
|
part: queryParameters['p'],
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -547,6 +550,7 @@ class PiliScheme {
|
|||||||
bool showDialog = true,
|
bool showDialog = true,
|
||||||
bool off = false,
|
bool off = false,
|
||||||
String? progress,
|
String? progress,
|
||||||
|
String? part,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
aid ??= IdUtils.bv2av(bvid!);
|
aid ??= IdUtils.bv2av(bvid!);
|
||||||
@@ -554,7 +558,11 @@ class PiliScheme {
|
|||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
SmartDialog.showLoading<dynamic>(msg: '获取中...');
|
SmartDialog.showLoading<dynamic>(msg: '获取中...');
|
||||||
}
|
}
|
||||||
final int cid = await SearchHttp.ab2c(bvid: bvid, aid: aid);
|
final int cid = await SearchHttp.ab2c(
|
||||||
|
bvid: bvid,
|
||||||
|
aid: aid,
|
||||||
|
part: part != null ? int.tryParse(part) : null,
|
||||||
|
);
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user