Skip to content

[BUG] Cat not get lyrics even add cookies and oauth token #86

@luger1990

Description

@luger1990
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions