Skip to content

NJIT-CS490-SP21/Spotify-lookup

Repository files navigation

Project-1 Spotify lookup

Project 1 creates Music discovery app that uses Spotify API to dynamically fetch data form Spotify libraries to show top tracks of an Artist. The user will have option to pick an artist through a search bar on page. In case an artist is not picked the page will load top tracks for one of the three pre-selected artists.

technologies, frameworks, libraries, and APIs

Platform
This project is primarily made on amazons’ AWS cloud9 service. Cloud9 is a cloud-based IDE that lets us write, run, and debug out code just with a browser. And because it is a cloud-based service it makes it easy for us share our work.
Frame work
For Project 1 we are using Flask framework. Flask is a web framework, that provide us with tools, libraries and technologies that allow us to build and setup a web application.
Libraries

Flask:

from flask import Flask, render_template, request, redirect
  • Render_template: Flask configures jinj2 template automatically using grander_templete() method.
  • request: request is used to make HTTP GET and POST requests
  • redirect: redirect() is used to redirect a user to different endpoint.

Dotenv:

from dotenv import load_dotenv, find_dotenv

Dotenv library is going to be used for calling environment variables stored in .env file

  • load_dotenv is use to load environment variable.
  • find_dotenv() can be used to find .env file

Requests:

import requests

Requests allows us to easily send HTTP requests.

Example:

requests.post(tocken_url, data=tocken_data, headers=tocken_header)

Base64:

import base64

Base64 is used for RFC 3548 encoding, for URLs and HTTP POST requests. Example:

base64.b64encode(creds.encode())

urllib.parse.urlencode:

from urllib.parse import urlencode

urllib.parse.urlencode() is used for generating the query string of a URL or data for a POST request

APIs
  • This API is used to get an access token using client id and client secret.
  • Get spotify catalog information about an artist's top tracks using artist id and country.
  • Get Spotify catalog information for a single artist identified by their unique Spotify ID.
  • Get Spotify Catalog information about albums, artists, playlists, tracks, shows or episodes that match a keyword string.
  • Get song lyrics by passing in the song name

Installation

To use and run this project there are a couple of requirements:

1. Install Flask

To install flask open up the command prompt or terminal and type,

$ pip install Flask

in case that does not work type,

$ sudo pip install Flask

2. Install requests

To install Requests, simply run the following command in your terminal of choise:

$ python -m pip install requests

3. Install dotenv

To install dotenv run following command in terminal:

pip install python-dotenv

4. setup dotenv

  • Create a .env file in the project directory containing Spotify Client id and Client secret in following format:
export sptfy_id = "your client id"
export sptfy_sectret = "your client secret"
export genius_token = "your genius api access token"

Run Application

  1. Open up terminal and run command python spotify_app.py
  2. Click on "Preview" >> "Preview running application"

Link to website

Click here...

(Disclaimer: If you are using Grammarly extension in your browser, the app may not work properly. Please open the page in incognito tab or disable Grammarly for the website.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published