You should not use .readlines()
. Let the json
library do the reading:
response = urllib2.urlopen(request)
json_object = json.load(response)
Note the function name, .load()
, no s
at the end.
The object returned is a dictionary; each of the strings you see is a key into that dictionary. You need to specify what titles you'd want; the tracklist
and videos
entries both have a list of items with titles; here is how you'd print the tracklist
entry titles:
for track in json_object['tracklist']:
print track['title']
Which prints:
HIStory Begins
Billie Jean
The Way You Make Me Feel
Black Or White
Rock With You
She's Out Of My Life
Bad
I Just Can't Stop Loving You
Man In The Mirror
Thriller
Beat It
The Girl Is Mine
Remember The Time
Don't Stop 'Til You Get Enough
Wanna Be Startin' Somethin'
Heal The World
HIStory Continues
Scream
They Don't Care About Us
Stranger In Moscow
This Time Around
Earth Song
D.S.
Money
Come Together
You Are Not Alone
Childhood (Theme From "Free Willy 2")
Tabloid Junkie
2 Bad
History
Little Susie
Smile