Esempio n. 1
0
 def get_track_data(url):
     data = extract_ldjson_blob(url, clean=True)
     track = {
         'dateModified': data.get('dateModified'),
         'datePublished': data.get('datePublished'),
         "url": data.get('id') or url,
         "title": data.get("name"),
         "type": data.get("type"),
         'image': data.get('image'),
         'keywords': data.get('keywords', "").split(", ")
     }
     for k, v in get_props(data).items():
         track[k] = v
     return track
Esempio n. 2
0
 def get_album_data(url):
     data = extract_ldjson_blob(url, clean=True)
     props = get_props(data)
     return {
         'dateModified': data.get('dateModified'),
         'datePublished': data.get('datePublished'),
         'description': data.get('description'),
         "url": data.get('id') or url,
         "title": data.get("name"),
         "type": data.get("type"),
         "n_tracks": data.get('numTracks'),
         'image': data.get('image'),
         'featured_track_num': props.get('featured_track_num'),
         'keywords': data.get('keywords', "").split(", ")
     }
Esempio n. 3
0
    def get_tracks(url):
        data = extract_ldjson_blob(url, clean=True)
        if not data.get("track"):
            return []

        data = data['track']

        tracks = []

        for d in data.get('itemListElement', []):
            d = d['item']
            track = {
                "title": d.get('name'),
                "url": d.get('id') or url,
                'type': d.get('type'),
            }
            for k, v in get_props(d).items():
                track[k] = v
            tracks.append(BandcampTrack(track, scrap=False))
        return tracks