[reddit] restrict subreddit search results (#7025)
This commit is contained in:
@@ -259,6 +259,8 @@ class RedditSubredditExtractor(RedditExtractor):
|
||||
self.subreddit, sub, params = match.groups()
|
||||
self.params = text.parse_query(params)
|
||||
if sub:
|
||||
if sub == "search" and "restrict_sr" not in self.params:
|
||||
self.params["restrict_sr"] = "1"
|
||||
self.subcategory += "-" + sub
|
||||
RedditExtractor.__init__(self, match)
|
||||
|
||||
|
||||
@@ -40,6 +40,17 @@ __tests__ = (
|
||||
"#class" : reddit.RedditSubredditExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.reddit.com/r/IdiotsInCars/search/?q=flair%3AOC",
|
||||
"#comment" : "(#7025)",
|
||||
"#category": ("", "reddit", "subreddit-search"),
|
||||
"#class" : reddit.RedditSubredditExtractor,
|
||||
"#range" : "1-25",
|
||||
|
||||
"subreddit" : "IdiotsInCars",
|
||||
"link_flair_text": "OC",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.reddit.com/",
|
||||
"#category": ("", "reddit", "home"),
|
||||
|
||||
Reference in New Issue
Block a user