From 47e8747e1c2f3c0d1efd4735f843232153263e70 Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 29 Feb 2024 20:53:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=93=E6=A0=8F=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E7=99=BD=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/http/html.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/http/html.dart b/lib/http/html.dart index 20dc9444a..07db48688 100644 --- a/lib/http/html.dart +++ b/lib/http/html.dart @@ -41,11 +41,10 @@ class HtmlHttp { String opusContent = opusDetail.querySelector('.opus-module-content')!.innerHtml; String? test; - try { - test = opusDetail - .querySelector('.horizontal-scroll-album__pic__img')! - .innerHtml; - } catch (_) {} + test = opusDetail + .querySelector('.horizontal-scroll-album__pic__img') + ?.innerHtml ?? + ''; String commentId = opusDetail .querySelector('.bili-comment-container')! @@ -96,7 +95,7 @@ class HtmlHttp { // String opusContent = - opusDetail.querySelector('#read-article-holder')!.innerHtml; + opusDetail.querySelector('#read-article-holder')?.innerHtml ?? ''; RegExp digitRegExp = RegExp(r'\d+'); Iterable matches = digitRegExp.allMatches(id); String number = matches.first.group(0)!;