Git Product home page Git Product logo

musiclyricswrapper's Introduction

Music Lyrics Wrapper

This Wrapper searches for lyrics for your favorite songs. You don't need to enter any credentials or register your account.

Performance

This Wrapper uses a built-in cache to cache already searched songs and avoid getting rate-limited

Data source

This Wrapper uses Genius as data source. This isn't an official API. We are not partnered with Genius or anything similar

How to use

Create an instance of MusicLyricsClient.

MusicLyricsClient client = new MusicLyricsClient();

You can use the searchSong method to search for songs. This returns an Arraylist of MusicData objects, because there could be multiple results for one song name.

Search for songs:

MusicLyricsClient client = new MusicLyricsClient();
ArrayList<MusicData> songs = client.searchSong("Michael Jackson");

if(songs.isEmpty()) {
    System.out.println("No songs found");
} else {
    System.out.println(songs.get(0).getTitle());
}

The MusicData object just contains simple information like the title or the id (internally handled) but it also contains an image of the song if you want to have a preview. The MusicData object doesn't contain lyrics.

If you want to fetch lyrics without searching for songs you can just use the fetchLyrics method. You can search for lyrics just with your search term and without using the searchSong method.

It's recommended to use the searchSong method first, because there could be multiple songs matching your search term. You can filter the songs first and fetch the lyrics after you found the right song.

Fetch lyrics (easy way):

MusicLyricsClient client = new MusicLyricsClient();
MusicLyrics lyrics = client.fetchLyrics("Michael Jackson");

if(lyrics == null) {
    System.out.println("No lyrics found");
} else {
    System.out.println("Lyrics: " + lyrics.getContent());
}

Fetch lyrics (recommended way):

MusicLyricsClient client = new MusicLyricsClient();
ArrayList<MusicData> songs = client.searchSong("Michael Jackson");
MusicData firstSong = songs.get(0);

if(firstSong.getTitle().equals("my song")) {
    MusicLyrics lyrics = client.fetchLyrics(firstSong);
    
    if(lyrics == null) {
        System.out.println("No lyrics found");
    } else {
        System.out.println("Lyrics: " + lyrics.getContent());
    }
}

Install

Add the repository and dependency to your project.

Replace x.y.z with - the latest version of this project!

Gradle

dependencies {
   implementation 'com.github.GlaubeKeinemDev:MusicLyricsWrapper:x.y.z'
}

repositories {
    maven { url 'https://jitpack.io' }
}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.GlaubeKeinemDev</groupId>
    <artifactId>MusicLyricsWrapper</artifactId>
    <version>x.y.z</version>
</dependency>

Disclaimer

This repository is for private use only. Just use it to research your songs. This Wrapper is not official and we are not partnered with Genius or any relating companies.

I will take NO responsibility/liability for you and how you use the source code and which source code you are using. If you use this Wrapper or including files you agree that you use this AT YOUR OWN RISK.

musiclyricswrapper's People

Contributors

glaubekeinemdev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.