|
90 | 90 | ) |
91 | 91 | from .get_recently_played import GetRecentlyPlayed, GetRecentlyPlayedMe |
92 | 92 | from .get_recommendations import GetRecommendations, GetRecommendationsMe |
| 93 | +from .get_similar_artists import GetSimilarArtists, GetSimilarArtistsArtist |
93 | 94 | from .get_similar_tracks import GetSimilarTracks, GetSimilarTracksTrack |
94 | 95 | from .get_smart_tracklist import GetSmartTracklist, GetSmartTracklistSmartTracklist |
95 | 96 | from .get_track import GetTrack, GetTrackTrack |
@@ -755,7 +756,6 @@ async def get_artist( |
755 | 756 | fansCount |
756 | 757 | isFavorite |
757 | 758 | bio { |
758 | | - summary |
759 | 759 | full |
760 | 760 | } |
761 | 761 | } |
@@ -1146,7 +1146,6 @@ async def get_charts( |
1146 | 1146 | fansCount |
1147 | 1147 | isFavorite |
1148 | 1148 | bio { |
1149 | | - summary |
1150 | 1149 | full |
1151 | 1150 | } |
1152 | 1151 | } |
@@ -1322,7 +1321,6 @@ async def get_favorite_artists( |
1322 | 1321 | fansCount |
1323 | 1322 | isFavorite |
1324 | 1323 | bio { |
1325 | | - summary |
1326 | 1324 | full |
1327 | 1325 | } |
1328 | 1326 | } |
@@ -1978,7 +1976,6 @@ async def get_music_together_affinity( |
1978 | 1976 | fansCount |
1979 | 1977 | isFavorite |
1980 | 1978 | bio { |
1981 | | - summary |
1982 | 1979 | full |
1983 | 1980 | } |
1984 | 1981 | } |
@@ -2773,7 +2770,6 @@ async def get_recently_played( |
2773 | 2770 | fansCount |
2774 | 2771 | isFavorite |
2775 | 2772 | bio { |
2776 | | - summary |
2777 | 2773 | full |
2778 | 2774 | } |
2779 | 2775 | } |
@@ -2910,7 +2906,6 @@ async def get_recommendations( |
2910 | 2906 | fansCount |
2911 | 2907 | isFavorite |
2912 | 2908 | bio { |
2913 | | - summary |
2914 | 2909 | full |
2915 | 2910 | } |
2916 | 2911 | } |
@@ -2986,6 +2981,57 @@ async def get_recommendations( |
2986 | 2981 | data = self.get_data(response) |
2987 | 2982 | return GetRecommendations.model_validate(data).me |
2988 | 2983 |
|
| 2984 | + async def get_similar_artists( |
| 2985 | + self, |
| 2986 | + artist_id: str, |
| 2987 | + first: Union[Optional[int], UnsetType] = UNSET, |
| 2988 | + **kwargs: Any, |
| 2989 | + ) -> Optional[GetSimilarArtistsArtist]: |
| 2990 | + query = gql(""" |
| 2991 | + query GetSimilarArtists($artistId: String!, $first: Int = 25) { |
| 2992 | + artist(artistId: $artistId) { |
| 2993 | + relatedArtist(first: $first) { |
| 2994 | + edges { |
| 2995 | + node { |
| 2996 | + ...ArtistFields |
| 2997 | + } |
| 2998 | + } |
| 2999 | + pageInfo { |
| 3000 | + ...PageInfoFields |
| 3001 | + } |
| 3002 | + } |
| 3003 | + } |
| 3004 | + } |
| 3005 | +
|
| 3006 | + fragment ArtistFields on Artist { |
| 3007 | + id |
| 3008 | + name |
| 3009 | + picture { |
| 3010 | + id |
| 3011 | + urls(pictureRequest: {width: 264, height: 264}) |
| 3012 | + } |
| 3013 | + fansCount |
| 3014 | + isFavorite |
| 3015 | + bio { |
| 3016 | + full |
| 3017 | + } |
| 3018 | + } |
| 3019 | +
|
| 3020 | + fragment PageInfoFields on PageInfo { |
| 3021 | + hasNextPage |
| 3022 | + endCursor |
| 3023 | + } |
| 3024 | + """) |
| 3025 | + variables: dict[str, object] = {"artistId": artist_id, "first": first} |
| 3026 | + response = await self.execute( |
| 3027 | + query=query, |
| 3028 | + operation_name="GetSimilarArtists", |
| 3029 | + variables=variables, |
| 3030 | + **kwargs, |
| 3031 | + ) |
| 3032 | + data = self.get_data(response) |
| 3033 | + return GetSimilarArtists.model_validate(data).artist |
| 3034 | + |
2989 | 3035 | async def get_similar_tracks( |
2990 | 3036 | self, track_id: str, nb: Union[Optional[int], UnsetType] = UNSET, **kwargs: Any |
2991 | 3037 | ) -> Optional[GetSimilarTracksTrack]: |
@@ -3357,7 +3403,6 @@ async def get_user_charts( |
3357 | 3403 | fansCount |
3358 | 3404 | isFavorite |
3359 | 3405 | bio { |
3360 | | - summary |
3361 | 3406 | full |
3362 | 3407 | } |
3363 | 3408 | } |
|
0 commit comments