[GH-ISSUE #86] [BUG] Cat not get lyrics even add cookies and oauth token #87

Open
opened 2026-03-13 23:01:21 +03:00 by kerem · 0 comments
Owner

Originally created by @luger1990 on GitHub (Nov 1, 2025).
Original GitHub issue: https://github.com/AliAkhtari78/SpotifyScraper/issues/86

import json

from spotify_scraper import SpotifyClient

client = SpotifyClient(cookie_file='spotify_cookies.txt', headers={
    'Authorization': 'Bearer BQDXsHPaTVtNVIprEnzrsw-sq6SZQuwv7WHkPjbWlM5s5bKgzLsNr1SkY6YL8-Drn-YHIUU6Fdt6qX7QtfxkQ5QZaIP3KhGFnNYq3m_s46Y8HmNxYJYG9xL75Yt1tOATwseLuxxxxx'},
                       browser_type='selenium',
                       use_webdriver_manager=True
                       )
track_url = "https://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6"
print(client)
print(type(client.browser.driver))

# try add cookies mannually
with open("spotify_cookies.txt", "r", encoding="utf-8") as f:
    cookies = json.load(f)
client.browser.driver.get(track_url)
for cookie in cookies:
    if isinstance(cookie.get('expiry'), float):
        cookie['expiry'] = int(cookie['expiry'])
    cookie['sameSite'] = 'None'
    cookie['domain'] = 'spotify.com'
    client.browser.driver.add_cookie(cookie)


result = client.get_track_info_with_lyrics(track_url)
print(json.dumps(result))

this is my code. I want to get spotify lyrics, but it not work. and I event add cookies mannually. please have a look. Thanks.

Originally created by @luger1990 on GitHub (Nov 1, 2025). Original GitHub issue: https://github.com/AliAkhtari78/SpotifyScraper/issues/86 ```python import json from spotify_scraper import SpotifyClient client = SpotifyClient(cookie_file='spotify_cookies.txt', headers={ 'Authorization': 'Bearer BQDXsHPaTVtNVIprEnzrsw-sq6SZQuwv7WHkPjbWlM5s5bKgzLsNr1SkY6YL8-Drn-YHIUU6Fdt6qX7QtfxkQ5QZaIP3KhGFnNYq3m_s46Y8HmNxYJYG9xL75Yt1tOATwseLuxxxxx'}, browser_type='selenium', use_webdriver_manager=True ) track_url = "https://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6" print(client) print(type(client.browser.driver)) # try add cookies mannually with open("spotify_cookies.txt", "r", encoding="utf-8") as f: cookies = json.load(f) client.browser.driver.get(track_url) for cookie in cookies: if isinstance(cookie.get('expiry'), float): cookie['expiry'] = int(cookie['expiry']) cookie['sameSite'] = 'None' cookie['domain'] = 'spotify.com' client.browser.driver.add_cookie(cookie) result = client.get_track_info_with_lyrics(track_url) print(json.dumps(result)) ``` this is my code. I want to get spotify lyrics, but it not work. and I event add cookies mannually. please have a look. Thanks.
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/SpotifyScraper#87
No description provided.