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!;
|
||||||
|
@ -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