[GH-ISSUE #16] LRC format not actually LRC? #10

Closed
opened 2026-02-27 19:05:17 +03:00 by kerem · 3 comments
Owner

Originally created by @beveradb on GitHub (Feb 15, 2023).
Original GitHub issue: https://github.com/akashrchandran/spotify-lyrics-api/issues/16

Hey, thank you for making this! It makes it much easier to pull lyrics from spotify rather than using devtools and finding the URL like I'd been doing 😅

However, why does the LRC format option still output JSON, rather than an actual LRC file?

Am I missing something? (and if so, would you be willing to accept a PR adding a new format option called "lrcfile" or something which actually does?)

Originally created by @beveradb on GitHub (Feb 15, 2023). Original GitHub issue: https://github.com/akashrchandran/spotify-lyrics-api/issues/16 Hey, thank you for making this! It makes it much easier to pull lyrics from spotify rather than using devtools and finding the URL like I'd been doing 😅 However, why does the LRC format option still output JSON, rather than an actual LRC file? Am I missing something? (and if so, would you be willing to accept a PR adding a new `format` option called "lrcfile" or something which actually does?)
kerem closed this issue 2026-02-27 19:05:18 +03:00
Author
Owner

@akashrchandran commented on GitHub (Feb 16, 2023):

Sorry for the late reply.

Actually this project is not focused on end users rather it's for the developers. Using this API they can integrate Spotify lyrics into their projects without having to worry about the authentication part, which is handled by the API I provide.

If I provide a direct lrc download option I don't think it will do any good to the developers. Providing JSON is a better way than that, so that they can manipulate and change the data according to their needs.

If you really just want to download the lrc file then better to use other projects that I have already built.

Syrics: A command line utility solely made for the purpose of downloading Spotify lyrics.

If you're not a big command line fan, then you can use this:

Syrics-web: A web implementation of syrics, which can download lrc files directly on the web. The deployed version is available at https://syrics-web.vercel.app

Ps: Web version is limited to 50 tracks for album and 100 tracks for playlist. Will fix it soon :).

<!-- gh-comment-id:1433237773 --> @akashrchandran commented on GitHub (Feb 16, 2023): Sorry for the late reply. Actually this project is not focused on end users rather it's for the developers. Using this API they can integrate Spotify lyrics into their projects without having to worry about the authentication part, which is handled by the API I provide. If I provide a direct lrc download option I don't think it will do any good to the developers. Providing JSON is a better way than that, so that they can manipulate and change the data according to their needs. If you really just want to download the lrc file then better to use other projects that I have already built. [Syrics](https://github.com/akashrchandran/syrics): A command line utility solely made for the purpose of downloading Spotify lyrics. If you're not a big command line fan, then you can use this: [Syrics-web](https://github.com/akashrchandran/syrics-web): A web implementation of syrics, which can download lrc files directly on the web. The deployed version is available at https://syrics-web.vercel.app Ps: Web version is limited to 50 tracks for album and 100 tracks for playlist. Will fix it soon :).
Author
Owner

@beveradb commented on GitHub (Feb 16, 2023):

Nice, thanks for the reply and link to Syrics, the CLI version of that is exactly what I was looking for last night but didn't come across it when searching 😅

Instead I ended up asking ChatGPT to:
"Write a python script to fetch an JSON object of synced lyrics from this URL, "https://spotify-lyric-api.herokuapp.com/?format=lrc&url=", passing in the first parameter to the script as the "url" parameter, exiting with an error message if the parameter is missing. Inside this JSON object, there is a key called "lines" which is a list of objects containing two keys, "timeTag" and "words". Iterate through all of these "lines" and build up an output file in the LRC lyrics format. Write this generated LRC file to disk, with a unique filename containing the current date and time."

10 seconds later I had this, which works great and solved my use case at the time - though I'm sure Syrics does a better job and probably handles edge cases etc. better!

import json
import os
import sys
import urllib.request

# Get the URL from the command line arguments
if len(sys.argv) < 2:
    print("Error: Missing URL parameter")
    sys.exit(1)
url = sys.argv[1]

# Fetch the JSON object
response = urllib.request.urlopen("https://spotify-lyric-api.herokuapp.com/?format=lrc&url=" + url)
json_data = response.read().decode()
data = json.loads(json_data)

# Build the LRC lyrics
lines = data["lines"]
lrc_lines = []
for line in lines:
    time_tag = line["timeTag"]
    words = line["words"]
    lrc_line = f"[{time_tag}] {words}"
    lrc_lines.append(lrc_line)
lrc_lyrics = "\n".join(lrc_lines)

# Write the LRC file to disk
now = datetime.datetime.now()
filename = f"lyrics_{now.strftime('%Y-%m-%d_%H-%M-%S')}.lrc"
with open(filename, "w") as f:
    f.write(lrc_lyrics)

print(f"LRC file '{filename}' has been generated.")

Anyway, thank you for building this! It's saving me time when creating karaoke versions of niche tracks :)

<!-- gh-comment-id:1433612984 --> @beveradb commented on GitHub (Feb 16, 2023): Nice, thanks for the reply and link to Syrics, the CLI version of that is exactly what I was looking for last night but didn't come across it when searching 😅 Instead I ended up asking ChatGPT to: "Write a python script to fetch an JSON object of synced lyrics from this URL, "https://spotify-lyric-api.herokuapp.com/?format=lrc&url=", passing in the first parameter to the script as the "url" parameter, exiting with an error message if the parameter is missing. Inside this JSON object, there is a key called "lines" which is a list of objects containing two keys, "timeTag" and "words". Iterate through all of these "lines" and build up an output file in the LRC lyrics format. Write this generated LRC file to disk, with a unique filename containing the current date and time." 10 seconds later I had this, which works great and solved my use case at the time - though I'm sure Syrics does a better job and probably handles edge cases etc. better! ```import datetime import json import os import sys import urllib.request # Get the URL from the command line arguments if len(sys.argv) < 2: print("Error: Missing URL parameter") sys.exit(1) url = sys.argv[1] # Fetch the JSON object response = urllib.request.urlopen("https://spotify-lyric-api.herokuapp.com/?format=lrc&url=" + url) json_data = response.read().decode() data = json.loads(json_data) # Build the LRC lyrics lines = data["lines"] lrc_lines = [] for line in lines: time_tag = line["timeTag"] words = line["words"] lrc_line = f"[{time_tag}] {words}" lrc_lines.append(lrc_line) lrc_lyrics = "\n".join(lrc_lines) # Write the LRC file to disk now = datetime.datetime.now() filename = f"lyrics_{now.strftime('%Y-%m-%d_%H-%M-%S')}.lrc" with open(filename, "w") as f: f.write(lrc_lyrics) print(f"LRC file '{filename}' has been generated.") ``` Anyway, thank you for building this! It's saving me time when creating karaoke versions of niche tracks :)
Author
Owner

@akashrchandran commented on GitHub (Feb 18, 2023):

Have to say it's a well written prompt. Good that you were able to make it work. If you have any doubt or need any assistance you can feel free to contact me.

<!-- gh-comment-id:1435498033 --> @akashrchandran commented on GitHub (Feb 18, 2023): Have to say it's a well written prompt. Good that you were able to make it work. If you have any doubt or need any assistance you can feel free to contact me.
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/spotify-lyrics-api#10
No description provided.