Skip to content
Snippets Groups Projects
Commit 397c60fb authored by Hector Blondel's avatar Hector Blondel
Browse files

changement répertoire

parent 2285ab04
Branches
No related tags found
No related merge requests found
......@@ -15,13 +15,15 @@ while True :
data = load(f)
for playlist in data :
os.chdir("musics/"+playlist)
chn = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId='+playlist+'&key='+KEY
requete = get(chn)
dico = requete.json()
all_videos = [x['snippet']['resourceId']['videoId'] for x in dico['items']]
with open("musics/"+playlist+'/seen.json','r') as f2 :
with open('seen.json','r') as f2 :
seen_videos = load(f2)
os.chdir("contents")
i = 0
while i < len(all_videos) and all_videos[i] not in seen_videos :
vid = all_videos[i]
......@@ -30,10 +32,14 @@ while True :
seen_videos.append(vid)
i += 1
with open("musics/"+playlist+'/seen.json','w') as f2 :
os.chdir("../")
with open('seen.json','w') as f2 :
f2.write(dumps(seen_videos))
"""
playlist = "PL8V2Ld0Is1-kWGtqHFOJiwwnU1lWbpC1r"
chn = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId='+playlist+'&key='+KEY
requete = get(chn)
......@@ -42,4 +48,4 @@ requete = get(chn)
dico = requete.json()
l = dico['items']
print([x['snippet']['resourceId']['videoId'] for x in l])
\ No newline at end of file
"""
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment