def prettify_reddit_query(subreddit_entry):
#for search queries; make the reddit query string presentable
if subreddit_entry.startswith('?'):
#log('************ prettify_reddit_query='+subreddit_entry)
tbn=subreddit_entry.split('/')[-1]
tbn=urllib.unquote_plus(tbn)
tbn=tbn.replace('?q=','[LIGHT]search:[/LIGHT]' )
tbn=tbn.replace('site:','' )
tbn=tbn.replace('&sort=','[LIGHT] sort by:[/LIGHT]' )
tbn=tbn.replace('&t=','[LIGHT] from:[/LIGHT]' )
tbn=tbn.replace('subreddit:','r/' )
tbn=tbn.replace('author:','[LIGHT] by:[/LIGHT]' )
tbn=tbn.replace('&restrict_sr=on','' )
tbn=tbn.replace('&restrict_sr=','' )
tbn=tbn.replace('nsfw:no','' )
tbn=tbn.replace('nsfw:yes','nsfw' )
#log('************ prettify_reddit_query='+tbn)
return tbn
else:
return subreddit_entry
评论列表
文章目录