Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit cfd7f52d authored by Hachemin Pierre-Yves's avatar Hachemin Pierre-Yves

Merge branch 'get2005' into 'master'

dictionnary 2005

See merge request !5
parents 1306dad4 703c5b13
......@@ -16,18 +16,17 @@ def get_movie_ids(year):
req = requests.get(url_final)
dict_movies = {}
nb_of_pages = req.json()['total_pages']
print(nb_of_pages)
for item in req.json()['results']:
movie_id = item['id']
video_link = get_video_link(movie_id)
dict_movies[movie_id] = [item['vote_average'], item["genre_ids"], video_link]
f = open("Link-dictionnary2003.txt", "w")
f = open("./Link-dictionnaries/Link-dictionnary2005.txt", "w")
f.write(str(dict_movies))
f.close()
for page in range(2, nb_of_pages+1):
time.sleep(5)
#print(datetime.datetime.now() - now1)
#print(len(dict_movies))
print(dict_movies)
print(len(dict_movies))
print(f"taking care of page # {page}...")
......@@ -38,7 +37,7 @@ def get_movie_ids(year):
video_link = get_video_link(movie_id)
if video_link != '':
dict_movies[movie_id] = [item['vote_average'], item["genre_ids"], video_link]
f = open("Link-dictionnary.txt", "w")
f = open("./Link-dictionnaries/Link-dictionnary2005.txt", "w")
f.write(str(dict_movies))
f.close()
return dict_movies
......@@ -53,7 +52,6 @@ def get_video_link(movie_id):
else:
return ''
#print(get_video_link(157336))
f = open("Link-dictionnary.txt", "w")
print(get_movie_ids(2003))
print(get_movie_ids(2005))
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment