diff --git a/CHANGELOG.md b/CHANGELOG.md index 7874e46..c0dcf82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.2.1 + +- Fixed `SearchPage.nextPage`. +- Added more tests. + ## 1.2.0 - Improved documentation. - Deprecated `StreamInfoExt.getHighestBitrate`, use list.`sortByBitrate`. @@ -5,6 +10,7 @@ - Implemented `withHighestBitrate` for `VideoStreamInfo` iterables. - Now `sortByVideoQuality` returns a List of `T`. - `SearchQuery.nextPage` now returns null if there is no next page. + ## 1.1.0 - Implement parsing of the search page to retrieve information from youtube searches. See `SearchQuery`. diff --git a/lib/src/reverse_engineering/responses/search_page.dart b/lib/src/reverse_engineering/responses/search_page.dart index 35e9e64..1b6b0ec 100644 --- a/lib/src/reverse_engineering/responses/search_page.dart +++ b/lib/src/reverse_engineering/responses/search_page.dart @@ -136,10 +136,10 @@ class _InitialData { Map getContinuationContext(Map root) { if (_root['contents'] != null) { - return _root['contents']['twoColumnSearchResultsRenderer'] - ['primaryContents']['sectionListRenderer']['contents'] - ?.first['itemSectionRenderer']['continuations'] - ?.first + return (_root['contents']['twoColumnSearchResultsRenderer'] + ['primaryContents']['sectionListRenderer']['contents'] + ?.first['itemSectionRenderer']['continuations'] + ?.first as Map) ?.getValue('nextContinuationData') ?.cast(); } diff --git a/pubspec.yaml b/pubspec.yaml index 1446848..89d1e1b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: youtube_explode_dart description: A port in dart of the youtube explode library. Supports several API functions without the need of Youtube API Key. -version: 1.2.0+2 +version: 1.2.1 homepage: https://github.com/Hexer10/youtube_explode_dart environment: diff --git a/test/search_test.dart b/test/search_test.dart index f91a10c..f8d1947 100644 --- a/test/search_test.dart +++ b/test/search_test.dart @@ -26,5 +26,15 @@ void main() { expect(searchQuery.relatedVideos, isNotEmpty); expect(searchQuery.relatedQueries, isNotEmpty); }, skip: 'This may fail on some environments'); + + test('SearchNoResults', () async { + var query = + await yt.search.queryFromPage('g;jghEOGHJeguEPOUIhjegoUEHGOGHPSASG'); + expect(query.content, isEmpty); + expect(query.relatedQueries, isEmpty); + expect(query.relatedVideos, isEmpty); + var nextPage = await query.nextPage(); + expect(nextPage, isNull); + }); }); }