def build_reddit_search_context_menu_entries(hasmultiplesubreddit,subreddit,link_url ):
cxm_list=[]
colored_subreddit_full=colored_subreddit( subreddit )
label_search=translation(32520)
parts_of_link_url=urlparse.urlparse(link_url)
if cxm_show_search:
if GCXM_hasmultiplesubreddit:
cxm_list.append( (label_search , build_script("search", '', '') ) )
else:
label_search+=' {0}'.format(colored_subreddit_full)
cxm_list.append( (label_search , build_script("search", '', subreddit) ) )
#NOTE: can't use the entire link_url because it will work for www.reddit.com but not for oauth.reddit.com
part_to_search="{0} {1}".format(parts_of_link_url.path,parts_of_link_url.query)
if part_to_search.startswith('/'): part_to_search=part_to_search[1:] #remove starting '/'
remove_these_words=['.mp4','.webm','/v/','.jpg','.png'] #mainly to match imgur links where we want to catch the imageID not "imageID.mp4"
part_to_search=re.sub('|'.join(re.escape(word) for word in remove_these_words), '', part_to_search)
#log('parts to search='+part_to_search)
cxm_list.append( (translation(32531) , build_script("listSubReddit", assemble_reddit_filter_string(part_to_search,'','',''), name=translation(32531)) ) ) #"Other posts with this link"
return cxm_list
评论列表
文章目录