fix: article request

This commit is contained in:
bggRGjQaUbCoE
2024-10-05 19:54:08 +08:00
parent 9f6c50aaac
commit 1f32cf3bd2
3 changed files with 14 additions and 7 deletions

View File

@@ -11,7 +11,9 @@ class HtmlHttp {
"https://www.bilibili.com/opus/$id",
extra: {'ua': 'pc'},
);
if (response.data is! String && response.data is! List<int>) {
return;
}
if (response.data.contains('Redirecting to')) {
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
Match match = regex.firstMatch(response.data)!;
@@ -73,6 +75,9 @@ class HtmlHttp {
"https://www.bilibili.com/$dynamicType/$id/",
extra: {'ua': 'pc'},
);
if (response.data is! String && response.data is! List<int>) {
return;
}
Document rootTree = parse(response.data);
Element body = rootTree.body!;
Element appDom = body.querySelector('#app')!;

View File

@@ -32,6 +32,7 @@ class HtmlRenderController extends ReplyController {
} else {
res = await HtmlHttp.reqReadHtml(id, dynamicType);
}
if (res != null) {
response = res;
oid.value = res['commentId'];
queryData();
@@ -39,6 +40,7 @@ class HtmlRenderController extends ReplyController {
loaded.value = true;
}
}
}
@override
Future<LoadingState> customGetData() => ReplyHttp.replyList(

View File

@@ -444,7 +444,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
padding: const EdgeInsets.fromLTRB(12, 8, 12, 8),
sliver: Obx(
() => _htmlRenderCtr.loaded.value
? _htmlRenderCtr.response['isJsonContent']
? _htmlRenderCtr.response['isJsonContent'] == true
? ArticleContent(
htmlContent: _htmlRenderCtr.response['content'],
)