33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 | # Also has a neat JSON API, so is quite easy to support.
import re
import json
from config import *
from channels import *
import ahttp as http
# API endpoints:
# http://www.radio-browser.info/webservice/json/countries
# http://www.radio-browser.info/webservice/json/languages
# http://www.radio-browser.info/webservice/json/tags
# http://www.radio-browser.info/webservice/json/stations/topclick |
|
| 33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 | # Also has a neat JSON API, so is quite easy to support.
import re
import json
from config import *
from channels import *
import ahttp
# API endpoints:
# http://www.radio-browser.info/webservice/json/countries
# http://www.radio-browser.info/webservice/json/languages
# http://www.radio-browser.info/webservice/json/tags
# http://www.radio-browser.info/webservice/json/stations/topclick |
108
109
110
111
112
113
114
115
116
117
118
119
120 | bitrate = - int(e["negativevotes"]),
))
return r
# fetch multiple pages
def api(self, method, params={}):
j = http.get(self.base + method, params)
try:
return json.loads(j, strict=False) # some entries contain invalid character encodings
except:
return []
|
|
| 108
109
110
111
112
113
114
115
116
117
118
119
120 | bitrate = - int(e["negativevotes"]),
))
return r
# fetch multiple pages
def api(self, method, params={}):
j = ahttp.get(self.base + method, params)
try:
return json.loads(j, strict=False) # some entries contain invalid character encodings
except:
return []
|