Merge remote-tracking branch 'origin/master' into jcbirdwell-alt_auth
This commit is contained in:
commit
90af0c7a5a
3 changed files with 24 additions and 8 deletions
|
|
@ -120,14 +120,19 @@ class BrowsingMixin:
|
|||
"""
|
||||
Get information about an artist and their top releases (songs,
|
||||
albums, singles, videos, and related artists). The top lists
|
||||
contain pointers for getting the full list of releases. For
|
||||
songs/videos, pass the browseId to :py:func:`get_playlist`.
|
||||
For albums/singles, pass browseId and params to :py:func:
|
||||
`get_artist_albums`.
|
||||
contain pointers for getting the full list of releases.
|
||||
|
||||
For songs/videos, pass the browseId to :py:func:`get_playlist`.
|
||||
For albums/singles, pass browseId and params to :py:func:`get_artist_albums`.
|
||||
|
||||
:param channelId: channel id of the artist
|
||||
:return: Dictionary with requested information.
|
||||
|
||||
.. warning::
|
||||
|
||||
The returned channelId is not the same as the one passed to the function.
|
||||
It should be used only with :py:func:`subscribe_artists`.
|
||||
|
||||
Example::
|
||||
|
||||
{
|
||||
|
|
@ -243,7 +248,7 @@ class BrowsingMixin:
|
|||
"""
|
||||
Get the full list of an artist's albums or singles
|
||||
|
||||
:param channelId: channel Id of the artist
|
||||
:param channelId: browseId of the artist as returned by :py:func:`get_artist`
|
||||
:param params: params obtained by :py:func:`get_artist`
|
||||
:return: List of albums in the format of :py:func:`get_library_albums`,
|
||||
except artists key is missing.
|
||||
|
|
|
|||
|
|
@ -7,13 +7,15 @@ from ._utils import validate_order_parameter, prepare_order_params
|
|||
from ytmusicapi.helpers import *
|
||||
from ytmusicapi.navigation import *
|
||||
from ytmusicapi.continuations import get_continuations
|
||||
from ytmusicapi.parsers.library import parse_library_albums, parse_library_artists, get_library_contents
|
||||
from ytmusicapi.parsers.library import parse_library_albums, parse_library_artists, get_library_contents, \
|
||||
pop_songs_random_mix
|
||||
from ytmusicapi.parsers.albums import parse_album_header
|
||||
from ytmusicapi.parsers.uploads import parse_uploaded_items
|
||||
from ..auth.types import AuthType
|
||||
|
||||
|
||||
class UploadsMixin:
|
||||
|
||||
def get_library_upload_songs(self, limit: int = 25, order: str = None) -> List[Dict]:
|
||||
"""
|
||||
Returns a list of uploaded songs
|
||||
|
|
@ -47,7 +49,8 @@ class UploadsMixin:
|
|||
results = get_library_contents(response, MUSIC_SHELF)
|
||||
if results is None:
|
||||
return []
|
||||
songs = parse_uploaded_items(results['contents'][1:])
|
||||
pop_songs_random_mix(results)
|
||||
songs = parse_uploaded_items(results['contents'])
|
||||
|
||||
if 'continuations' in results:
|
||||
request_func = lambda additionalParams: self._send_request(
|
||||
|
|
|
|||
|
|
@ -75,11 +75,19 @@ def parse_library_artists(response, request_func, limit):
|
|||
return artists
|
||||
|
||||
|
||||
def pop_songs_random_mix(results) -> None:
|
||||
"""remove the random mix that conditionally appears at the start of library songs"""
|
||||
if results:
|
||||
if len(results['contents']) >= 2:
|
||||
results['contents'].pop(0)
|
||||
|
||||
|
||||
def parse_library_songs(response):
|
||||
results = get_library_contents(response, MUSIC_SHELF)
|
||||
pop_songs_random_mix(results)
|
||||
return {
|
||||
'results': results,
|
||||
'parsed': parse_playlist_items(results['contents'][1:]) if results else results
|
||||
'parsed': parse_playlist_items(results['contents']) if results else results
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue