Skip to content

Instantly share code, notes, and snippets.

@coreyar
Last active September 15, 2018 21:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreyar/2105de5970401e1ae3b3442e1c574a2a to your computer and use it in GitHub Desktop.
Save coreyar/2105de5970401e1ae3b3442e1c574a2a to your computer and use it in GitHub Desktop.
API Documentation for the Crank Live Api

Realtime Airplay

http://crankdev1.cranklive.com/ http://crankdev1.cranklive.com/losangeles.html

This page displays real-time airplay by station call letters, artist, label, title, date and time. If it displays a genre like 'Pop Hits" or "Alternative" those are Music Choice channels as they are broadcast nationally.

(These feeds are captured directly from the over the air source and not internet monitored in order to provide 99.9% accuracy)

Historical Airplay

This is updating in realtime so if queried every few seconds after a song is detected it will be available

API Path : http://dev.cranknow.com/api/v1/songs/airplay/by/{startdate}/{endDate}?page=1&pageSize=200

HttpMethod : GET

Parameters :

  1. startdate (required) route parameter eg (09-14-2018)
  2. enddate(required) route parameter eg (09-15-2018)
  3. page (optional) querystring paramater (default value 1)
  4. pageSize (optional) querystring paramater (default value 100)

startdate must be less than from enddate or equal

Bearer Token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9lbWFpbGFkZHJlc3MiOiJjaHJpcy5tY211cnRyeUBleGFjdHVhbHMuY29tIiwiVWxzSWQiOiI1Yjk2YThhOGE1ZDZhYzBlMDhjMWRlY2EiLCJVc2VySWQiOiJjaHJpcy5tY211cnRyeUBleGFjdHVhbHMuY29tIiwiSWQiOiI1Yjk2YTA5MzllYTZjMGRiNjNiY2FkYWYiLCJVc2VyVHlwZSI6ImxhYmVsIiwiSXNTdXBlclVzZXIiOiJGYWxzZSIsImV4cCI6MTUzNzIwNTAzMiwiaXNzIjoiY3JhbmtsaXZlLmNvbSIsImF1ZCI6ImNyYW5rbGl2ZS5jb20ifQ.tLOsT0jpALMUBpQCwuWO1Grwk6HDAoUrILi9tm4wwqA 

Reponse : Api return airplays and count of total airplays as per given parameter values

{airplays: AirplayResponse, totalCount: int }

airplays are list of :

public class AirplayResponse
    {
        public string StationName { get; set; }
        public DateTime PlayedOnDate { get; set; }
        public string Title { get; set; }
        public string Album { get; set; }
        public string Label { get; set; }
        public string Acrid { get; set; }
        public string StationType { get; set; }
        public string ArtistName { get; set; }
     
    }

Python example

import requests
token = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9lbWFpbGFkZHJlc3MiOiJjaHJpcy5tY211cnRyeUBleGFjdHVhbHMuY29tIiwiVWxzSWQiOiI1Yjk2YThhOGE1ZDZhYzBlMDhjMWRlY2EiLCJVc2VySWQiOiJjaHJpcy5tY211cnRyeUBleGFjdHVhbHMuY29tIiwiSWQiOiI1Yjk2YTA5MzllYTZjMGRiNjNiY2FkYWYiLCJVc2VyVHlwZSI6ImxhYmVsIiwiSXNTdXBlclVzZXIiOiJGYWxzZSIsImV4cCI6MTUzNzIwNTAzMiwiaXNzIjoiY3JhbmtsaXZlLmNvbSIsImF1ZCI6ImNyYW5rbGl2ZS5jb20ifQ.tLOsT0jpALMUBpQCwuWO1Grwk6HDAoUrILi9tm4wwqA'

headers = { 'Authorization': token }

start_date = '09-10-2018'
end_date = '09-15-2018'
url = 'http://dev.cranknow.com/api/v1/songs/airplay/by/{}/{}'.format(start_date, end_date)
params = { 'page': 1, 'pageSize': 200 }
r = requests.get(url, headers=headers, params=params)
print(r.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment