searchMusic static method

Future<List<Song>>? searchMusic({
  1. int page = 1,
  2. int? genreType,
  3. int? mood,
  4. String? search,
  5. List<String>? version,
})

Implementation

static Future<List<Song>>? searchMusic(
    {int page = 1,
    int? genreType,
    int? mood,
    String? search,
    List<String>? version}) async {
  String url =
      "https://ncs.io/music-search?page=$page${(genreType != null) ? '&genre=$genreType' : ''}${(mood != null) ? '&mood=$mood' : ''}${(version != null) ? '&version=${version.join('-')}' : ''}${(search != null) ? '&q=$search' : ''}";
  var document = await Chaleno().load(url);
  Result? table = document?.querySelector('.tablesorter');
  List<Song> songs = JustParser.parseTable(table: table);
  return songs;
}