Index: contrib/radionet.py ================================================================== --- contrib/radionet.py +++ contrib/radionet.py @@ -1,11 +1,11 @@ # encoding: UTF-8 # api: streamtuner2 # title: radio.net # description: Europe's biggest radio platform # url: http://radio.net/ -# version: 0.7 +# version: 0.8 # type: channel # category: radio # png: # iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAt0lEQVR42mNgYGD4r+Ar/F/BDwkD+SBxojBMs1mLPBArgGlFqEEENYMNQNLsukIDYkirAvGu # ABsA1OC6XOP/5f8nwIaYAg0k2gBFsAsgTgcZkvnfDugFEeK9AFKsCPMG0CU6eZJgQ4R1eP8H7LLEivWyFJANQcQCLPBAmkGG4MJohmA6C6QA5gI5OxEUDNII @@ -16,15 +16,13 @@ # Radio.net lists around 20.000 worldwide radio stations. # A maximum of three pages from each genre are fetched here, # some of the empty categories already omitted. # # The website heavily depends on JavaScript, a Flash player, -# some social tracking cookies. But still feasible to access -# per custom JSON extractor. -# -# May require refreshing the station lists once in a while, -# because there's an API key in each JSON station info URL. +# some social tracking cookies. Now requires additional page +# request to get real streaming url, but at least no more +# expiring access key. import time import json import re @@ -62,11 +60,11 @@ class radionet (ChannelPlugin): # control flags has_search = False audioformat = "audio/mpeg" - listformat = "rnjs" + listformat = "href" titles = dict(listeners=False, playing="Description") # sources apiPrefix = "https://api.radio.net/info/v2" genre_url = "http://www.radio.net/genre/{}" @@ -88,52 +86,54 @@ html = ahttp.get(self.genre_url.format(cat)) for p in range(2, 4): if html.find('"?p={}">'.format(p)) >= 0: html += ahttp.get(self.genre_url.format(cat) + "?p={}".format(p)) self.set_key(html) - log.HTML(html) r = [] # split station blocks - for row in re.split("""