mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: article request
This commit is contained in:
@@ -11,7 +11,9 @@ class HtmlHttp {
|
|||||||
"https://www.bilibili.com/opus/$id",
|
"https://www.bilibili.com/opus/$id",
|
||||||
extra: {'ua': 'pc'},
|
extra: {'ua': 'pc'},
|
||||||
);
|
);
|
||||||
|
if (response.data is! String && response.data is! List<int>) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (response.data.contains('Redirecting to')) {
|
if (response.data.contains('Redirecting to')) {
|
||||||
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
|
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
|
||||||
Match match = regex.firstMatch(response.data)!;
|
Match match = regex.firstMatch(response.data)!;
|
||||||
@@ -73,6 +75,9 @@ class HtmlHttp {
|
|||||||
"https://www.bilibili.com/$dynamicType/$id/",
|
"https://www.bilibili.com/$dynamicType/$id/",
|
||||||
extra: {'ua': 'pc'},
|
extra: {'ua': 'pc'},
|
||||||
);
|
);
|
||||||
|
if (response.data is! String && response.data is! List<int>) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Document rootTree = parse(response.data);
|
Document rootTree = parse(response.data);
|
||||||
Element body = rootTree.body!;
|
Element body = rootTree.body!;
|
||||||
Element appDom = body.querySelector('#app')!;
|
Element appDom = body.querySelector('#app')!;
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ class HtmlRenderController extends ReplyController {
|
|||||||
} else {
|
} else {
|
||||||
res = await HtmlHttp.reqReadHtml(id, dynamicType);
|
res = await HtmlHttp.reqReadHtml(id, dynamicType);
|
||||||
}
|
}
|
||||||
response = res;
|
if (res != null) {
|
||||||
oid.value = res['commentId'];
|
response = res;
|
||||||
queryData();
|
oid.value = res['commentId'];
|
||||||
if (res['status'] == true) {
|
queryData();
|
||||||
loaded.value = true;
|
if (res['status'] == true) {
|
||||||
|
loaded.value = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
|||||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 8),
|
padding: const EdgeInsets.fromLTRB(12, 8, 12, 8),
|
||||||
sliver: Obx(
|
sliver: Obx(
|
||||||
() => _htmlRenderCtr.loaded.value
|
() => _htmlRenderCtr.loaded.value
|
||||||
? _htmlRenderCtr.response['isJsonContent']
|
? _htmlRenderCtr.response['isJsonContent'] == true
|
||||||
? ArticleContent(
|
? ArticleContent(
|
||||||
htmlContent: _htmlRenderCtr.response['content'],
|
htmlContent: _htmlRenderCtr.response['content'],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user