diff --git a/changelog/v8.0.5+267.md b/changelog/v8.0.5+267.md index 1992683d..ee65ef37 100644 --- a/changelog/v8.0.5+267.md +++ b/changelog/v8.0.5+267.md @@ -1,5 +1,7 @@ - 优化搜索标签提示 +- 适配E站不再能查看非本人上传画廊的排行数据的变动 -------------------- -- Optimize the search tag prompt \ No newline at end of file +- Optimize the search tag prompt +- Adapt to the change that users can no longer view the ranking data of galleries uploaded by others \ No newline at end of file diff --git a/lib/src/utils/eh_spider_parser.dart b/lib/src/utils/eh_spider_parser.dart index 911107f0..7969d2f1 100644 --- a/lib/src/utils/eh_spider_parser.dart +++ b/lib/src/utils/eh_spider_parser.dart @@ -806,7 +806,8 @@ class EHSpiderParser { static GalleryStats statPage2GalleryStats(Headers headers, dynamic data) { Document document = parse(data as String); - Element rankScoreTbody = document.querySelector('.stuffbox > table > tbody')!; + /// Ranking is only available for owner + Element? rankScoreTbody = document.querySelector('.stuffbox > table > tbody'); List graphs = document.querySelectorAll('#graphs > div'); Element yearlyStatTbody = graphs[2].querySelector('table > tbody')!; Element monthlyStatTbody = graphs[1].querySelector('table > tbody')!; @@ -814,14 +815,14 @@ class EHSpiderParser { return GalleryStats( totalVisits: int.parse(document.querySelector('.stuffbox > p > strong')!.text.replaceAll(',', '')), - allTimeRanking: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(2) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), - allTimeScore: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(2) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), - yearRanking: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(4) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), - yearScore: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(4) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), - monthRanking: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(6) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), - monthScore: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(6) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), - dayRanking: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(8) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), - dayScore: int.tryParse(rankScoreTbody.querySelector('tr:nth-child(8) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), + allTimeRanking: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(2) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), + allTimeScore: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(2) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), + yearRanking: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(4) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), + yearScore: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(4) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), + monthRanking: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(6) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), + monthScore: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(6) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), + dayRanking: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(8) > td:nth-child(4)')?.text.replaceAll(',', '') ?? ''), + dayScore: int.tryParse(rankScoreTbody?.querySelector('tr:nth-child(8) > td:nth-child(5)')?.text.replaceAll(',', '') ?? ''), yearlyStats: _parseStats(yearlyStatTbody), monthlyStats: _parseStats(monthlyStatTbody), dailyStats: _parseStats(dailyStatTbody), diff --git a/lib/src/widget/eh_gallery_stat_dialog.dart b/lib/src/widget/eh_gallery_stat_dialog.dart index 581cb072..008b8469 100644 --- a/lib/src/widget/eh_gallery_stat_dialog.dart +++ b/lib/src/widget/eh_gallery_stat_dialog.dart @@ -104,6 +104,11 @@ class _EHGalleryStatDialogState extends State { snack('getGalleryStatisticsFailed'.tr, e.message); setStateSafely(() => loadingState = LoadingState.error); return; + } catch (e) { + log.error('getGalleryStatisticsFailed'.tr, e.toString()); + snack('getGalleryStatisticsFailed'.tr, e.toString()); + setStateSafely(() => loadingState = LoadingState.error); + return; } if (mounted) { diff --git a/pubspec.lock b/pubspec.lock index 8117de7a..43ec8220 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -929,18 +929,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "10.0.7" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "3.0.8" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: @@ -1499,7 +1499,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.0" + version: "0.0.99" smart_auth: dependency: transitive description: @@ -1592,10 +1592,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.11.1" stream_channel: dependency: transitive description: @@ -1616,10 +1616,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.0" syncfusion_flutter_charts: dependency: "direct main" description: @@ -1929,10 +1929,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "14.3.0" + version: "14.2.5" wakelock_plus: dependency: "direct main" description: