feat: fav article

Closes #727

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-23 11:59:48 +08:00
parent 0d27d88719
commit a0abd472e0
9 changed files with 120 additions and 15 deletions

View File

@@ -72,14 +72,18 @@ class HtmlHttp {
// List imgList = opusDetail.querySelectorAll('bili-album__preview__picture__img');
dynamic mid;
Map? favorite;
try {
final regex = RegExp(r'window\.__INITIAL_STATE__\s*=\s*(\{.*?\});');
final match = regex.firstMatch(response.data);
if (match != null) {
final json = jsonDecode(match.group(1)!);
mid = json['detail']['basic']['uid'];
favorite = json['detail']['modules'].last['module_stat']['favorite'];
}
} catch (_) {}
} catch (e) {
debugPrint('req html: $e');
}
return {
'status': true,
@@ -90,6 +94,7 @@ class HtmlHttp {
'content': (test ?? '') + opusContent,
'commentType': int.parse(comment[1]),
'commentId': int.parse(comment[2]),
'favorite': favorite,
};
} catch (err) {
debugPrint('err: $err');