https://github.com/marcusziade/songlink-cli
A Song.Link CLI app written in Go
https://github.com/marcusziade/songlink-cli
cli go linux macos music windows
Last synced: about 1 year ago
JSON representation
A Song.Link CLI app written in Go
- Host: GitHub
- URL: https://github.com/marcusziade/songlink-cli
- Owner: marcusziade
- License: mit
- Created: 2022-09-01T17:50:57.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-28T22:54:05.000Z (over 1 year ago)
- Last Synced: 2025-04-10T00:51:25.461Z (about 1 year ago)
- Topics: cli, go, linux, macos, music, windows
- Language: Go
- Homepage:
- Size: 1.59 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Songlink CLI
[](https://github.com/marcusziade/songlink-cli/releases)
A Go program that retrieves Songlink and Spotify links for a given URL using the Songlink API. It also allows searching for songs and albums directly using Apple Music API. The output is designed to be shared as is, allowing the receiver to both use Songlink and listen to the song preview using Spotify's embed feature.
## Features
- Retrieves Songlink and Spotify links for a given song or album URL
- **NEW**: Search for songs and albums directly using Apple Music API
- Supports command line arguments for customizing the output format
- Automatically copies the output to the clipboard for easy sharing
- Includes a loading indicator to provide visual feedback during the retrieval process
- Thoroughly tested with unit tests to ensure reliability and correctness
## Installation
### macOS
#### Homebrew
```
brew tap marcusziade/songlink-cli
brew install songlink-cli
```
#### Build
1. Clone the repository: `git clone https://github.com/marcusziade/songlink-cli.git`
2. Navigate to the project directory: `cd songlink-cli`
3. Install dependencies: `go mod download`
4. Build the executable: `go build -o songlink .`
5. Run the program: `./songlink`
### Download and Run
Go to [Releases](https://github.com/marcusziade/songlink-cli/releases) and download the appropriate version for your operating system (Linux, macOS, Windows).
## Usage
### Process URL from clipboard
1. Copy the URL of the song or album you want to retrieve links for.
2. Run the program using one of the following commands:
- `./songlink`: Retrieves only the Songlink URL
- `./songlink -x`: Retrieves the Songlink URL without surrounding `<>`. For Twitter
- `./songlink -d`: Retrieves the Songlink URL surrounded by `<>` and the Spotify URL. For Discord.
- `./songlink -s`: Retrieves only the Spotify URL
3. The program will automatically retrieve the Songlink and/or Spotify link for the song or album and copy it to your clipboard.
### Search for songs or albums
1. Configure your Apple Music API credentials (first time only):
```
./songlink config
```
2. Search for a song or album:
```
./songlink search "song or album name"
```
3. Select from the search results by entering the number.
4. The program will retrieve the Songlink and/or Spotify link for the selected song or album and copy it to your clipboard based on your flags.
#### Search Flags
- `-type=song`: Search for songs only (default)
- `-type=album`: Search for albums only
- `-type=both`: Search for both songs and albums
Combined with output format flags:
```
./songlink search -type=album -d "Dark Side of the Moon"
```
## Apple Music API Setup
To use the search functionality, you need Apple Music API credentials. The CLI includes a guided setup process:
1. Run `./songlink config`
2. Follow the prompts to enter your Apple Developer credentials:
- Team ID
- Key ID
- Private Key (from your .p8 file)
- Music ID (usually the same as Team ID)
Your credentials will be securely stored in `~/.songlink-cli/config.json`
## Examples
Here are a few examples of how to use the Songlink CLI:
- Retrieve only the Songlink URL:
```
./songlink
```
- Retrieve the Songlink URL without surrounding `<>` + Spotify embed:
```
./songlink -x
```
- Retrieve the Songlink URL surrounded by `<>` + Spotify embed:
```
./songlink -d
```
- Retrieve only the Spotify URL:
```
./songlink -s
```
- Search for a song and get links:
```
./songlink search "Bohemian Rhapsody"
```
- Search for an album with specific output format:
```
./songlink search -type=album -d "Abbey Road"
```
## Contributions
I welcome contributions to the Songlink CLI project! If you have any ideas, suggestions, or bug reports, please don't hesitate to open an issue or submit a pull request. To contribute:
1. Fork the repository
2. Create a new branch for your feature or bug fix
3. Make your changes and commit them with descriptive commit messages
4. Push your changes to your forked repository
5. Submit a pull request to the main repository
I appreciate your help in making this project better!
## License
This project is licensed under the [MIT License](LICENSE).
---
I hope you find this tool useful! If you have any questions or need further assistance, please let me know.