We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code below does not throw an error but does if the same instance is used.
Uploading all tracks in a folder, then getting their video ids ( using the difference from before ) and adding to existing playlist.
def getYTMusic(): return YTMusic('headers_auth.json') def UploadFolderTracksAndAddToPlaylistWorker(folder:str,playlistId:str,initialFetchLimit:int,sleepTime:float) -> UploadFolderTracksAndAddToPlaylistResult: # ytmusic.get_library_upload_songs uploadVideoIdsBefore = GetLatestUploadVideoIds(getYTMusic(),initialFetchLimit) ytmusic = getYTMusic(); notUploadable = [] uploadResponses = [] numSuccessfulUploads = 0 for root, dirs, files in os.walk(folder, topdown=False): for name in files: fullPath = os.path.join(root, name) if IsUploadable(name): response = ytmusic.upload_song(fullPath) if successfulResponse(response): uploadResponses.append(UploadResponse(fullPath,True)) numSuccessfulUploads = numSuccessfulUploads + 1 else: uploadResponses.append(UploadResponse(fullPath,False)) else: notUploadable.append(fullPath) newFetchLimit = initialFetchLimit + len(uploadResponses) print("sleeping to allow for videoIds *********************") time.sleep(sleepTime) uploadVideoIdsAfter = GetLatestUploadVideoIds(getYTMusic(),newFetchLimit) newUploadVideoIds = list(filter(lambda videoId:not videoId in uploadVideoIdsBefore,uploadVideoIdsAfter)) numNewUploadVideoIds = len(newUploadVideoIds) if numNewUploadVideoIds != numSuccessfulUploads: print("Not all videoids present") # could sleep and retrieve again updatePlaylistResponse = getYTMusic().add_playlist_items(playlistId,newUploadVideoIds) return UploadFolderTracksAndAddToPlaylistResult(notUploadable,uploadResponses,newFetchLimit,updatePlaylistResponse)
response object
{'error': {'code': 400, 'errors': [...], 'message': 'Unknown error.', 'status': 'INVALID_ARGUMENT'}} special variables: function variables: 'error': {'code': 400, 'errors': [{...}], 'message': 'Unknown error.', 'status': 'INVALID_ARGUMENT'} special variables: function variables: 'code': 400 'message': 'Unknown error.' 'errors': [{'domain': 'gdata.CoreErrorDomain', 'location': 'client', 'locationType': 'other', 'message': 'Unknown error.', 'reason': 'INVALID_VALUE'}] special variables: function variables: 0: {'domain': 'gdata.CoreErrorDomain', 'location': 'client', 'locationType': 'other', 'message': 'Unknown error.', 'reason': 'INVALID_VALUE'} len(): 1 'status': 'INVALID_ARGUMENT' len(): 4 len(): 1
The text was updated successfully, but these errors were encountered:
Ah yes, I believe this error is caused by assigning a reference to self.headers and then modifying it, instead of making a shallow copy. Good catch.
Can you change
ytmusicapi/ytmusicapi/mixins/uploads.py
Line 223 in 9bded79
in your local install to
headers = self.headers.copy()
and report back?
I believe that should fix it.
Sorry, something went wrong.
2d3219b
No branches or pull requests
The code below does not throw an error but does if the same instance is used.
Uploading all tracks in a folder, then getting their video ids ( using the difference from before ) and adding to existing playlist.
response object
The text was updated successfully, but these errors were encountered: