def searchReddits(url, subreddit, type_):
from default import urlMain
from main_listing import listSubReddit
#reddit search only works with a single subreddit
if subreddit:
initial_search_string='restrict_sr=on&sort=relevance&t=all&q='
initial_url=urlMain+'/r/'+subreddit
else:
initial_search_string='sort=relevance&t=year&q='
initial_url=urlMain
keyboard = xbmc.Keyboard(initial_search_string, translation(32073))
keyboard.doModal()
if keyboard.isConfirmed() and keyboard.getText():
search_string=keyboard.getText()
if search_string:
search_string=urllib.quote_plus(search_string,safe='&=') #only &= are used because they're in the initial_search_string
# #this https://www.reddit.com/r/Art/.json?&nsfw:no+&limit=10
# #becomes https://www.reddit.com/r/Art/search.json?&nsfw:no+&limit=10&q=SEARCHTERM&restrict_sr=on&sort=relevance&t=all
url = initial_url +"/search.json?" +search_string #+ '+' + nsfw # + sites_filter skip the sites filter
listSubReddit(url, 'Search', "")
评论列表
文章目录