SpotHack is a project where you can convert your Spotify Playlists to .mp3 files in the respective folder. Download your favorites musics and playlists to listen when you are offline. SpotHack is also an open-source project so is possible anyone help since reporting bugs, writing code, documentation, giving ideas or just checking the homepage.
- Download & Installation
- How it works?
- Getting Started
- API Credentials
- Pages/Features
- Technologies Used
- Disclaimer
- License
You can download this App in the Releases or build the code with some changes that you may want.
- Download APK - (don't forget the API Credentials)
- Download and Build the Code
- Download APK π for my friends - (need password to install π)
After you select your music or playlist our Download Machine
will, with the YouTube Scraper or the YouTube API, search for the music video, with the query starting with the artists name followed by the track name. Once we get the YouTube ID we can download the music video and convert it to .mp3
with ffmpeg
.
-
Git
to clone the repository; -
Yarn
to install dependencies; -
For run the project you will need the
React Native
Environment configured. You can follow the ReactNative Official Documentation;
Note: This project was only tested and developed for Android, so I don't know if it works properly in IOS. Is recommended that you run it in an Android Phone
;
$ git clone https://github.com/Darguima/SpotHack.git
$ yarn
This App use 2 third-party APIs:
- Spotify Api (Web Api)
- Youtube Api (YouTube Data API v3)
You can save this credentials in a .env
file or input them directly on the App. To get the required credentials you can follow our tutorial.
- To setup the application you can use:
yarn start
yarn android
At this moment you should have a Android Emulator with SpotHack
running
Fill in the required inputs (and remember the password):
$ keytool -genkey -v -keystore android/app/spothack.keystore -alias spothack -keyalg RSA -keysize 2048 -validity 10000
Edit the file android/app/build.gradle
, changing storePassword
and keyPassword
to the previous password.
cd android
./gradlew assembleRelease
Based on this tutorial.
For store the credentials you can create a file .env
with the next structure or you can input the credentials directly in the App, on Login Screen.
SPOTIFY_CLIENT_ID= ...
SPOTIFY_CLIENT_SECRET= ...
YOUTUBE_API_KEY= ...
As the entire App is based on Spotify's repertoire, it is required have access to their API, or in others words: a Client Id
and a Client Secret
. To get this tokens you can follow the next tutorial:
-
Access the Spotify Developer Dashboard.
-
Login with any Spotify Account.
-
Click on
Create App
(name of your choice). -
Edit the Settings - add
com.darguima.spothack://oauthredirect
toRedirect URIs
-
Go to
Users and Access
>Add new user
and fill in with your users accounts. -
Now you are able to copy the
Client ID
and theClient Secret
spotifyCredentails.mp4
Unlike Spotify, YouTube API is not essential for the App flow, so you can omit this key without problems, but if for some reason the YouTube Scrape
Server is not working, this can be a plan B for Music Download. To get the API Key
is a little more complicated than Spotify; Follow the next steps:
-
Access the Google Cloud Platform Console.
-
Login with any Google Account.
-
Click on
Select a Project
>New Project
. -
Create a project with a name of your choice and Select it.
-
Select in
Navigation Menu
>APIs and services
>Library
-
Search and Enable
YouTube Data API v3
-
Go to
OAuth consent Screen
and selectExternal
>Create
, then fill in the required inputs and continue to the end. -
Go to
Credentials
and clickCreate Credentials
>API key
. Now you can copy the key!
YoutubeCredentials.mp4
- Enter your APIs tokens (if not configured on APK building).
- Login !!
- Shortcuts to "Outdated Playlists", "Downloads Manager", "Settings Page" and others ...
- Search for your favorite musics and playlists.
- Download them !!
- Follow the download status of your musics.
- Know about the errors.
- Change the "Root Path", "Download Default Source", "Music Time Limit", and the Render Mode.
- Follow your playlist Status.
- Download the news musics.
- Delete the old ones.
- Reference a Playlist to a folder, if we can't do it.
-
core β
- JavaScript/TypeScript
- React Native
-
storage πΎ
- Async Storage - to save data as settings and histories
- react-native-encrypted-storage - to save users' APIs tokens
- react-native-dotenv - to save my APIs tokens
-
download π₯
- react-native-ytdl - used to download the mp4 video from Youtube
- react-native-ffmpeg - used to convert mp4 videos downloaded to mp3
- react-native-fs - used to save the mp3 files on the chosen path
- react-native-foreground-service - used to keep the download process active even if in background or closed
-
others
- react-native-inappbrowser-reborn - used to access the Spotify Login Page
This project can be considered a piracy service to download music. No source code here was used in production, nor was it ever used with the idea of making money. I only disposed of the code as open source because this is a study project. If you want to use it as a service, use it at your own risk, but remember that artists and publishers are likely to own the downloaded music.
This project is licensed under the MIT License - see the LICENSE file for details.