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: 1.0 +# version: 1.1 # type: channel # category: radio # png: # iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAt0lEQVR42mNgYGD4r+Ar/F/BDwkD+SBxojBMs1mLPBArgGlFqEEENYMNQNLsukIDYkirAvGu # ABsA1OC6XOP/5f8nwIaYAg0k2gBFsAsgTgcZkvnfDugFEeK9AFKsCPMG0CU6eZJgQ4R1eP8H7LLEivWyFJANQcQCLPBAmkGG4MJohmA6C6QA5gI5OxEUDNII @@ -24,10 +24,11 @@ import time import json import re +import traceback from config import * from channels import * import ahttp import action @@ -96,35 +97,49 @@ self.status(p / 5.5) if html.find('?p={}"'.format(p)) >= 0: html += ahttp.get(self.genre_url.format(urlcat) + "?p={}".format(p)) self.set_key(html) r = [] - + + # fetch JSON + ls_json = re.findall("__CONTEXT_PROVIDER__\s*=\s*(\{.+\});", html) + if ls_json: + try: + return self.from_json(ls_json) + except: + log.error("JSON extraction failed", traceback.format_exc()) + # prefetch images from embedded json (genres and location would also be sourceable from "playables":[…]) imgs = dict(re.findall('\],"id":"(\w+)","logo100x100":"(htt[^"]+)",', html)) #log.DATA(imgs) # top 100 of the most horrible html serializations """ - -