This been bugging me for quite a few hours. I’ve been searching a lot and I have found a lot of information. The problem is, I’m not that good, I’m actually a beginner to the max. I’d like to achieve this with Python (if it’s possible!). Maybe with JavaScript and PHP also? Let me explain.
I just found this website http://listeningroom.net and it’s great. You can create/join rooms and upload tracks and listen to them together with friends.
I’d like to extract/scrape/get some specific data from a .json file.
This file contains artist, album title, track title and more. I’d like to extract just the artist, album and track title.
http://listeningroom.net/room/chillasfuck/spins.json The .json file Contains the tracks played in the past 24 hours.
I managed to scrape the whole .json file with Python after looking around, (local .json file) with the following probably not so valid code.
json_data=open('...\spins.json')
data = json.load(json_data)
pprint(data)
json_data.close()
This prints out the following:
[{u'endTime': u'1317752614105',
u'id': u'cf37894e8eaf886a0d000000',
u'length': 492330,
u'metadata': {u'album': u'Mezzanine',
u'artist': u'Massive Attack',
u'bitrate': 128000,
u'label': u'Virgin',
u'length': 17494.479054779807,
u'title': u'Group Four'},
Just a part of the print
1. I’d like to scrape it from an url (the one provided at the top)
2. Just get ‘album’, ‘artist’ and ‘title’
3. Make sure it prints it as simple as possible like this:
Artist
Track title
Album
Artist
Track title
Album
4. If it’s not too much, save it to a .txt file
I hope I could get some help, I really want to create this for myself, so I can check out more music!
Marvin
Python (after you loaded the json)
To save in a file: