Skip to content

Instantly share code, notes, and snippets.

View vlad-ds's full-sized avatar

Vlad Gheorghe vlad-ds

View GitHub Profile
import requests
def get_id(track_name: str, token: str) -> str:
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': f'Bearer ' + token,
}
params = [
('q', track_name),
('type', 'track'),
@vlad-ds
vlad-ds / spoty.py
Last active February 1, 2020 17:54
{"access_token": some-string,
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": another-string,
"scope": "user-read-recently-played",
"expires_at": 1580462935}
@vlad-ds
vlad-ds / spoty.py
Last active February 1, 2020 17:54
print(token)
>> T2_wi8XsUpJrbD0BHQH4vX0BrSuYV0D88sVrQ_wMgApU9hP3g17MFIGBJwy6VJAB BwJKttS11Egej9RzGDuN4U4UUTLCECxVBWSrmrTT0iomaUtuapPkMgWa_uTjYijhnHI2czgPCZItzO4KAD
@vlad-ds
vlad-ds / spoty.py
Last active February 1, 2020 17:54
import spotipy.util as util
username = 'your-spotify-username'
client_id ='your-client-id'
client_secret = 'your-client-secret'
redirect_uri = 'http://localhost:7777/callback'
scope = 'user-read-recently-played'
token = util.prompt_for_user_token(username=username,
scope=scope,
import ast
from typing import List
from os import listdir
def get_streamings(path: str = 'MyData') -> List[dict]:
files = ['MyData/' + x for x in listdir(path)
if x.split('.')[0][:-1] == 'StreamingHistory']
all_streamings = []
@vlad-ds
vlad-ds / spoty.py
Last active February 1, 2020 17:54
pip install spotipy
pip install requests
pip install pandas