getTasteProfile method
Fetches suggested artists from taste profile (music.youtube.com/tasteprofile). Must be authenticated.
Tasteprofile allows users to pick artists to update their recommendations. Only returns a list of suggested artists, not the actual list of selected entries.
Returns Map with artist and their selection & impression value
Example:
{
'Drake': {
'selectionValue': 'tastebuilder_selection=/m/05mt_q',
'impressionValue': 'tastebuilder_impression=/m/05mt_q',
},
}
Implementation
Future<JsonMap> getTasteProfile() async {
checkAuth();
final response = await sendRequest('browse', {
'browseId': 'FEmusic_tastebuilder',
});
final profiles = nav(response, TASTE_PROFILE_ITEMS) as List<JsonMap>;
final tasteProfiles = <String, dynamic>{};
for (final itemList in profiles) {
for (final item
in (itemList['tastebuilderItemListRenderer']
as Map<String, List<JsonMap>>)['contents']!) {
final artist =
(nav(item['tastebuilderItemRenderer'], TASTE_PROFILE_ARTIST)
as List<JsonMap>)[0]['text'];
tasteProfiles[artist as String] = {
'selectionValue':
(item['tastebuilderItemRenderer']
as Map<String, JsonMap>)['selectionFormValue'],
'impressionValue':
(item['tastebuilderItemRenderer']
as Map<String, JsonMap>)['impressionFormValue'],
};
}
}
return tasteProfiles;
}