opt req

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-15 09:52:25 +08:00
parent 1943b65788
commit 422b413778
51 changed files with 923 additions and 1143 deletions

View File

@@ -134,9 +134,9 @@ class Api {
// aid num 稿件avid 必要(可选) avid与bvid任选一个
// bvid str 稿件bvid 必要(可选) avid与bvid任选一个
// csrf str CSRF Token位于cookie 必要
static const String oneThree = '/x/web-interface/archive/like/triple';
static const String ugcTriple = '/x/web-interface/archive/like/triple';
static const String triple = '/pgc/season/episode/like/triple';
static const String pgcTriple = '/pgc/season/episode/like/triple';
// 获取指定用户创建的所有收藏夹信息
// 该接口也能查询目标内容id存在于那些收藏夹中

View File

@@ -27,7 +27,7 @@ class DanmakuHttp {
// assert(aid != null || bvid != null);
// assert(csrf != null || access_key != null);
// 构建参数对象
var params = <String, dynamic>{
var data = <String, dynamic>{
'type': type,
'oid': oid,
'msg': msg,
@@ -47,10 +47,8 @@ class DanmakuHttp {
var response = await Request().post(
Api.shootDanmaku,
data: params,
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (response.statusCode != 200) {
return {

View File

@@ -2,6 +2,7 @@ import 'package:PiliPlus/http/api.dart';
import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/models/user/danmaku_block.dart';
import 'package:PiliPlus/utils/accounts.dart';
import 'package:dio/dio.dart';
class DanmakuFilterHttp {
static Future danmakuFilter() async {
@@ -22,10 +23,11 @@ class DanmakuFilterHttp {
static Future danmakuFilterDel({required int ids}) async {
var res = await Request().post(
Api.danmakuFilterDel,
queryParameters: {
data: {
'ids': ids,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -43,11 +45,12 @@ class DanmakuFilterHttp {
}) async {
var res = await Request().post(
Api.danmakuFilterAdd,
queryParameters: {
data: {
'type': type,
'filter': filter,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {

View File

@@ -103,18 +103,20 @@ class FavHttp {
var res = type == 11
? await Request().post(
Api.unfavFolder,
queryParameters: {
data: {
'media_id': id,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
)
: await Request().post(
Api.unfavSeason,
queryParameters: {
data: {
'platform': 'web',
'season_id': id,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};

View File

@@ -420,9 +420,7 @@ class LiveHttp {
var res = await Request().post(
Api.setLiveFavTag,
data: data,
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {

View File

@@ -28,7 +28,6 @@ import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:PiliPlus/utils/wbi_sign.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
class MemberHttp {
static Future reportMember(
@@ -38,16 +37,14 @@ class MemberHttp {
}) async {
var res = await Request().post(
HttpString.spaceBaseUrl + Api.reportMember,
data: FormData.fromMap(
{
'mid': mid,
'reason': reason,
'reason_v2': ?reasonV2,
'csrf': Accounts.main.csrf,
},
),
data: {
'mid': mid,
'reason': reason,
'reason_v2': ?reasonV2,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
debugPrint('report: ${res.data}');
return {
'status': res.data['status'],
'msg': res.data['message'] ?? res.data['data'],
@@ -510,9 +507,7 @@ class MemberHttp {
'fid': fid,
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -538,9 +533,7 @@ class MemberHttp {
'csrf': Accounts.main.csrf,
// 'cross_domain': true
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'msg': '操作成功'};
@@ -591,9 +584,7 @@ class MemberHttp {
'tag': tagName,
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -614,9 +605,7 @@ class MemberHttp {
'name': name,
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -636,9 +625,7 @@ class MemberHttp {
'tagid': tagid,
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};

View File

@@ -187,16 +187,14 @@ class MsgHttp {
String? biz,
CancelToken? cancelToken,
}) async {
final file = await MultipartFile.fromFile(path);
Map<String, dynamic> data = {
'file_up': file,
'category': ?category,
'biz': ?biz,
'csrf': Accounts.main.csrf,
};
var res = await Request().post(
Api.uploadBfs,
data: FormData.fromMap(data),
data: FormData.fromMap({
'file_up': await MultipartFile.fromFile(path),
'category': ?category,
'biz': ?biz,
'csrf': Accounts.main.csrf,
}),
cancelToken: cancelToken,
);
if (res.data['code'] == 0) {
@@ -226,7 +224,8 @@ class MsgHttp {
});
var res = await Request().post(
HttpString.tUrl + Api.createTextDynamic,
data: FormData.fromMap(data),
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -272,7 +271,8 @@ class MsgHttp {
});
var res = await Request().post(
HttpString.tUrl + Api.removeMsg,
data: FormData.fromMap(data),
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -296,9 +296,7 @@ class MsgHttp {
'csrf_token': csrf,
'csrf': csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -354,7 +352,8 @@ class MsgHttp {
});
var res = await Request().post(
HttpString.tUrl + Api.setTop,
data: FormData.fromMap(data),
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -407,7 +406,7 @@ class MsgHttp {
}) async {
String csrf = Accounts.main.csrf;
final devId = getDevId();
Map<String, dynamic> base = {
Map<String, dynamic> data = {
'msg': {
'sender_uid': senderUid,
'receiver_id': receiverId,
@@ -425,7 +424,7 @@ class MsgHttp {
'csrf_token': csrf,
'csrf': csrf,
};
Map<String, dynamic> params = await WbiSign.makSign(base);
Map<String, dynamic> params = await WbiSign.makSign(data);
var res = await Request().post(
Api.sendMsg,
queryParameters: <String, dynamic>{
@@ -435,7 +434,7 @@ class MsgHttp {
'w_rid': params['w_rid'],
'wts': params['wts'],
},
data: base,
data: data,
options: Options(
contentType: Headers.formUrlEncodedContentType,
),

View File

@@ -196,9 +196,7 @@ class ReplyHttp {
'action': action,
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
@@ -216,13 +214,14 @@ class ReplyHttp {
}) async {
var res = await Request().post(
Api.likeReply,
queryParameters: {
data: {
'type': type,
'oid': oid,
'rpid': rpid,
'action': action,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
@@ -263,9 +262,7 @@ class ReplyHttp {
'action': isUpTop ? 0 : 1,
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};

View File

@@ -106,12 +106,15 @@ class UserHttp {
account ??= Accounts.history;
var res = await Request().post(
Api.pauseHistory,
queryParameters: {
data: {
'switch': switchStatus,
'jsonp': 'jsonp',
'csrf': account.csrf,
},
options: Options(extra: {'account': account}),
options: Options(
extra: {'account': account},
contentType: Headers.formUrlEncodedContentType,
),
);
return res;
}
@@ -134,11 +137,14 @@ class UserHttp {
account ??= Accounts.history;
var res = await Request().post(
Api.clearHistory,
queryParameters: {
data: {
'jsonp': 'jsonp',
'csrf': account.csrf,
},
options: Options(extra: {'account': account}),
options: Options(
extra: {'account': account},
contentType: Headers.formUrlEncodedContentType,
),
);
return res;
}
@@ -147,11 +153,12 @@ class UserHttp {
static Future toViewLater({String? bvid, dynamic aid}) async {
var res = await Request().post(
Api.toViewLater,
queryParameters: {
data: {
'aid': ?aid,
'bvid': ?bvid,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'msg': 'yeah稍后再看'};
@@ -201,10 +208,11 @@ class UserHttp {
static Future toViewClear([int? cleanType]) async {
var res = await Request().post(
Api.toViewClear,
queryParameters: {
data: {
'clean_type': ?cleanType,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'msg': '操作完成'};
@@ -369,9 +377,7 @@ class UserHttp {
"reason_type": reasonType,
"reason_desc": reasonType == 0 ? reasonDesc : null,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
options: Options(contentType: Headers.formUrlEncodedContentType),
);
return res.data as Map;
}

View File

@@ -360,9 +360,9 @@ class VideoHttp {
}
// 一键三连 pgc
static Future triple({dynamic epId, required dynamic seasonId}) async {
static Future pgcTriple({dynamic epId, required dynamic seasonId}) async {
var res = await Request().post(
Api.triple,
Api.pgcTriple,
data: {
'ep_id': epId,
'csrf': Accounts.main.csrf,
@@ -384,9 +384,9 @@ class VideoHttp {
}
// 一键三连
static Future oneThree({required String bvid}) async {
static Future ugcTriple({required String bvid}) async {
var res = await Request().post(
Api.oneThree,
Api.ugcTriple,
data: {
'aid': IdUtils.bv2av(bvid),
'eab_x': 2,
@@ -394,6 +394,8 @@ class VideoHttp {
'source': 'web_normal',
'ga': 1,
'csrf': Accounts.main.csrf,
'spmid': '333.788.0.0',
'statistics': '{"appId":100,"platform":5}',
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
@@ -529,7 +531,7 @@ class VideoHttp {
if (message == '') {
return {'status': false, 'msg': '请输入评论内容'};
}
Map<String, dynamic> data = {
final data = {
'type': type,
'oid': oid,
if (root != null && root != 0) 'root': root,
@@ -560,12 +562,13 @@ class VideoHttp {
}) async {
var res = await Request().post(
Api.replyDel,
queryParameters: {
data: {
'type': type, //type.index
'oid': oid,
'rpid': rpid,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true};
@@ -637,11 +640,12 @@ class VideoHttp {
}) async {
await Request().post(
Api.historyReport,
queryParameters: {
data: {
'aid': ?aid,
'type': ?type,
'csrf': Accounts.heartbeat.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
}
@@ -659,7 +663,7 @@ class VideoHttp {
final isPugv = videoType == VideoType.pugv;
await Request().post(
Api.heartBeat,
queryParameters: {
data: {
if (isPugv) 'aid': ?aid else 'bvid': ?bvid,
'cid': cid,
'epid': ?epid,
@@ -669,6 +673,7 @@ class VideoHttp {
'played_time': progress,
'csrf': Accounts.heartbeat.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
}
@@ -679,12 +684,13 @@ class VideoHttp {
}) async {
await Request().post(
Api.mediaListHistory,
queryParameters: {
data: {
'desc': desc,
'oid': oid,
'upper_mid': upperMid,
'csrf': Accounts.heartbeat.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
}
@@ -692,10 +698,11 @@ class VideoHttp {
static Future pgcAdd({int? seasonId}) async {
var res = await Request().post(
Api.pgcAdd,
queryParameters: {
data: {
'season_id': seasonId,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {
@@ -718,10 +725,11 @@ class VideoHttp {
static Future pgcDel({int? seasonId}) async {
var res = await Request().post(
Api.pgcDel,
queryParameters: {
data: {
'season_id': seasonId,
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {