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