-header = {'Authorization': "Authorization: Bearer " + refresh()}
-response = requests.get("https://api.spotify.com/v1/me/player/recently-played", headers = header).text
-data = json.loads(response)
-# open('./sampleoutput.json', 'w').write(response); # for debugging
-print("\"" + data['items'][0]['track']['name'] + "\" by " + data['items'][0]['track']['artists'][0]['name']);
+def getsong() :
+ header = {'Authorization': "Authorization: Bearer " + refresh()}
+ response = requests.get("https://api.spotify.com/v1/me/player/recently-played", headers = header).text
+ data = json.loads(response)
+ # open('./sampleoutput.json', 'w').write(response); # for debugging
+ return("\"" + re.sub('\s[\(][F|f][t|e][a][t][\.].*', '', data['items'][0]['track']['name']) + "\" by " + data['items'][0]['track']['artists'][0]['name']);
+
+if __name__ == '__getsong__' or '__main__':
+ getsong()