Fix Community Channel
This commit is contained in:
@@ -589,14 +589,18 @@ def filter_thread(filter, key, item, description):
|
|||||||
# for load json from item or url
|
# for load json from item or url
|
||||||
def load_json(item, no_order=False):
|
def load_json(item, no_order=False):
|
||||||
support.log()
|
support.log()
|
||||||
|
if type(item) == Item:
|
||||||
url = item.url if type(item) == Item else item
|
url = item.url
|
||||||
|
filterkey = item.filterkey
|
||||||
|
else:
|
||||||
|
url = item
|
||||||
|
filterkey = ''
|
||||||
try:
|
try:
|
||||||
if url.startswith('http'):
|
if url.startswith('http'):
|
||||||
json_file = httptools.downloadpage(url).data
|
json_file = httptools.downloadpage(url).data
|
||||||
else:
|
else:
|
||||||
json_file = open(url, "r").read()
|
json_file = open(url, "r").read()
|
||||||
if no_order or item.filterkey:
|
if no_order or filterkey:
|
||||||
json = jsontools.load(json_file)
|
json = jsontools.load(json_file)
|
||||||
else:
|
else:
|
||||||
json = jsontools.load(json_file, object_pairs_hook=OrderedDict)
|
json = jsontools.load(json_file, object_pairs_hook=OrderedDict)
|
||||||
|
|||||||
Reference in New Issue
Block a user