fix: 无法打开专栏
This commit is contained in:
@ -70,7 +70,7 @@ class HtmlHttp {
|
|||||||
static Future reqReadHtml(id, dynamicType) async {
|
static Future reqReadHtml(id, dynamicType) async {
|
||||||
var response = await Request().get(
|
var response = await Request().get(
|
||||||
"https://www.bilibili.com/$dynamicType/$id/",
|
"https://www.bilibili.com/$dynamicType/$id/",
|
||||||
extra: {'ua': 'pc'},
|
extra: {'ua': 'pc', 'opus-goback': '1'},
|
||||||
);
|
);
|
||||||
Document rootTree = parse(response.data);
|
Document rootTree = parse(response.data);
|
||||||
Element body = rootTree.body!;
|
Element body = rootTree.body!;
|
||||||
|
|||||||
@ -95,9 +95,9 @@ class Request {
|
|||||||
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
||||||
Random rand = Random();
|
Random rand = Random();
|
||||||
String rand_png_end = base64.encode(
|
String rand_png_end = base64.encode(
|
||||||
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
||||||
List<int>.filled(4, 0) +
|
List<int>.filled(4, 0) +
|
||||||
[73, 69, 78, 68] +
|
[73, 69, 78, 68] +
|
||||||
List<int>.generate(4, (_) => rand.nextInt(256))
|
List<int>.generate(4, (_) => rand.nextInt(256))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class Request {
|
|||||||
|
|
||||||
await Request().post(
|
await Request().post(
|
||||||
Api.activateBuvidApi,
|
Api.activateBuvidApi,
|
||||||
data: {'payload': jsonData},
|
data: {'payload': jsonData},
|
||||||
options: Options(contentType: 'application/json')
|
options: Options(contentType: 'application/json')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -197,6 +197,15 @@ class Request {
|
|||||||
if (extra['ua'] != null) {
|
if (extra['ua'] != null) {
|
||||||
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
||||||
}
|
}
|
||||||
|
if (extra['opus-goback'] != null) {
|
||||||
|
List<Cookie> cookies = await cookieManager.cookieJar
|
||||||
|
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||||
|
String cookieHeader = cookies
|
||||||
|
.map((cookie) => '${cookie.name}=${cookie.value}')
|
||||||
|
.join('; ');
|
||||||
|
options.headers!['cookie'] =
|
||||||
|
'$cookieHeader; opus-goback = ${extra['opus-goback']}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
options.responseType = resType;
|
options.responseType = resType;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user