[GH-ISSUE #258] get_lyrics not working: Server returned HTTP 400 Bad Request #199

Closed
opened 2026-02-27 22:08:34 +03:00 by kerem · 1 comment
Owner

Originally created by @mathigatti on GitHub (Feb 8, 2022).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/258

Hi! Thanks for sharing this awesome project, I was trying to download some lyrics following the guidelines from this PR but the method doesn't seem to be working anymore.

Here is my code and its stracktrace.

from ytmusicapi import YTMusic

ytmusic = YTMusic('headers_auth.json')
with YTMusic() as ytMusic:
    result = ytMusic.get_lyrics('LFJIxKC1tBc')
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
[<ipython-input-44-d0f9bd913602>](https://localhost:8080/#) in <module>()
      3 ytmusic = YTMusic('headers_auth.json')
      4 with YTMusic() as ytMusic:
----> 5     result = ytMusic.get_lyrics('LFJIxKC1tBc')

1 frames
[/usr/local/lib/python3.7/dist-packages/ytmusicapi/mixins/browsing.py](https://localhost:8080/#) in get_lyrics(self, browseId)
    664             raise Exception("Invalid browseId provided. This song might not have lyrics.")
    665 
--> 666         response = self._send_request('browse', {'browseId': browseId})
    667         lyrics['lyrics'] = nav(response, ['contents'] + SECTION_LIST_ITEM
    668                                + ['musicDescriptionShelfRenderer'] + DESCRIPTION, True)

[/usr/local/lib/python3.7/dist-packages/ytmusicapi/ytmusic.py](https://localhost:8080/#) in _send_request(self, endpoint, body, additionalParams)
    140                 response.status_code) + ": " + response.reason + ".\n"
    141             error = response_text.get('error', {}).get('message')
--> 142             raise Exception(message + error)
    143         return response_text
    144 

Exception: Server returned HTTP 400: Bad Request.
Request contains an invalid argument.
Originally created by @mathigatti on GitHub (Feb 8, 2022). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/258 Hi! Thanks for sharing this awesome project, I was trying to download some lyrics following the guidelines from this [PR](https://github.com/sigma67/ytmusicapi/pull/114) but the method doesn't seem to be working anymore. Here is my code and its stracktrace. ```python from ytmusicapi import YTMusic ytmusic = YTMusic('headers_auth.json') with YTMusic() as ytMusic: result = ytMusic.get_lyrics('LFJIxKC1tBc') ``` ```python --------------------------------------------------------------------------- Exception Traceback (most recent call last) [<ipython-input-44-d0f9bd913602>](https://localhost:8080/#) in <module>() 3 ytmusic = YTMusic('headers_auth.json') 4 with YTMusic() as ytMusic: ----> 5 result = ytMusic.get_lyrics('LFJIxKC1tBc') 1 frames [/usr/local/lib/python3.7/dist-packages/ytmusicapi/mixins/browsing.py](https://localhost:8080/#) in get_lyrics(self, browseId) 664 raise Exception("Invalid browseId provided. This song might not have lyrics.") 665 --> 666 response = self._send_request('browse', {'browseId': browseId}) 667 lyrics['lyrics'] = nav(response, ['contents'] + SECTION_LIST_ITEM 668 + ['musicDescriptionShelfRenderer'] + DESCRIPTION, True) [/usr/local/lib/python3.7/dist-packages/ytmusicapi/ytmusic.py](https://localhost:8080/#) in _send_request(self, endpoint, body, additionalParams) 140 response.status_code) + ": " + response.reason + ".\n" 141 error = response_text.get('error', {}).get('message') --> 142 raise Exception(message + error) 143 return response_text 144 Exception: Server returned HTTP 400: Bad Request. Request contains an invalid argument. ```
kerem closed this issue 2026-02-27 22:08:34 +03:00
Author
Owner
<!-- gh-comment-id:1033590653 --> @sigma67 commented on GitHub (Feb 9, 2022): Please refer to docs and tests for proper usage, providing the videoId is incorrect as you can see in your error message https://ytmusicapi.readthedocs.io/en/latest/reference.html?highlight=get_lyrics#ytmusicapi.YTMusic.get_lyrics https://ytmusicapi.readthedocs.io/en/latest/reference.html?highlight=get_lyrics#ytmusicapi.YTMusic.get_watch_playlist https://github.com/sigma67/ytmusicapi/blob/2e8c09a4307e1ea1d81306bb3b20b700be825e4c/tests/test.py#L139-L142
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#199
No description provided.