ytmusicapi/mixins/playlists.py
def add_playlist_items(self,
                           playlistId: str,
                           videoIds: List[str],
                           source_playlist: str = None,
                           duplicates: bool = False) -> Union[str, Dict]:
        """
        Add songs to an existing playlist

        :param playlistId: Playlist id
        :param videoIds: List of Video ids
        :param source_playlist: Playlist id of a playlist to add to the current playlist (no duplicate check)
        :param duplicates: If True, duplicates will be added. If False, an error will be returned if there are duplicates (no items are added to the playlist)
        :return: Status String or full response
        """
        self._check_auth()
        body = {'playlistId': playlistId, 'actions': []}
        for videoId in videoIds:
            action = {'action': 'ACTION_ADD_VIDEO', 'addedVideoId': videoId}
            if duplicates:
                action['dedupeOption'] = 'DEDUPE_OPTION_SKIP'
            body['actions'].append(action)

        if source_playlist:
            body['actions'].append({
                'action': 'ACTION_ADD_PLAYLIST',
                'addedFullListId': source_playlist
            })

        endpoint = 'browse/edit_playlist'
        response = self._send_request(endpoint, body)
        return response['status'] \
            if 'status' in response and 'SUCCEEDED' in response['status'] \
            else response

        Add songs to an existing playlist

        :param playlistId: Playlist id
        :param videoIds: List of Video ids
        :param source_playlist: Playlist id of a playlist to add to the current playlist (no duplicate check)
        :param duplicates: If True, duplicates will be added. If False, an error will be returned if there are duplicates (no items are added to the playlist)
        :return: Status String or full response
        
Add songs to an existing playlist
Add songs to an existing playlist
def add_playlist_items(self,
                           playlistId: str,
                           videoIds: List[str],
                           source_playlist: str = None,
                           duplicates: bool = False) -> Union[str, Dict]:
        self._check_auth()
        body = {'playlistId': playlistId, 'actions': []}
        for videoId in videoIds:
            action = {'action': 'ACTION_ADD_VIDEO', 'addedVideoId': videoId}
            if duplicates:
                action['dedupeOption'] = 'DEDUPE_OPTION_SKIP'
            body['actions'].append(action)
        if source_playlist:
            body['actions'].append({
                'action': 'ACTION_ADD_PLAYLIST',
                'addedFullListId': source_playlist
            })
        endpoint = 'browse/edit_playlist'
        response = self._send_request(endpoint, body)
        return response['status'] \
            if 'status' in response and 'SUCCEEDED' in response['status'] \
            else response
def add_playlist_items ( self , playlistId : str , videoIds : List [ str ] , source_playlist : str = None , duplicates : bool = False ) -> Union [ str , Dict ] : self . _check_auth ( ) body = { 'playlistId' : playlistId , 'actions' : [ ] } for videoId in videoIds : action = { 'action' : 'ACTION_ADD_VIDEO' , 'addedVideoId' : videoId } if duplicates : action [ 'dedupeOption' ] = 'DEDUPE_OPTION_SKIP' body [ 'actions' ] . append ( action ) if source_playlist : body [ 'actions' ] . append ( { 'action' : 'ACTION_ADD_PLAYLIST' , 'addedFullListId' : source_playlist } ) endpoint = 'browse/edit_playlist' response = self . _send_request ( endpoint , body ) return response [ 'status' ] if 'status' in response and 'SUCCEEDED' in response [ 'status' ] else response
Add songs to an existing playlist
Add songs to an existing playlist
"""
        Add songs to an existing playlist

        :param playlistId: Playlist id
        :param videoIds: List of Video ids
        :param source_playlist: Playlist id of a playlist to add to the current playlist (no duplicate check)
        :param duplicates: If True, duplicates will be added. If False, an error will be returned if there are duplicates (no items are added to the playlist)
        :return: Status String or full response
        """
Status String or full response
Status String or full response
self
playlistId
str
None
videoIds
List[str]
List of Video ids
List of Video ids
source_playlist
str
Playlist id of a playlist to add to the current playlist (no duplicate check)
Playlist id of a playlist to add to the current playlist ( no duplicate check )
duplicates
bool
If True, duplicates will be added. If False, an error will be returned if there are duplicates (no items are added to the playlist)
If True duplicates will be added . If False an error will be returned if there are duplicates ( no items are added to the playlist )