Simplify regex string slightly
This commit is contained in:
@@ -207,7 +207,7 @@ class RedditDownloader:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _sanitise_subreddit_name(subreddit: str) -> str:
|
def _sanitise_subreddit_name(subreddit: str) -> str:
|
||||||
pattern = re.compile(r'^(?:https://www\.reddit\.com/)?(?:r/)?(.*?)(?:/)?$')
|
pattern = re.compile(r'^(?:https://www\.reddit\.com/)?(?:r/)?(.*?)/?$')
|
||||||
match = re.match(pattern, subreddit)
|
match = re.match(pattern, subreddit)
|
||||||
if not match:
|
if not match:
|
||||||
raise errors.BulkDownloaderException(f'Could not find subreddit name in string {subreddit}')
|
raise errors.BulkDownloaderException(f'Could not find subreddit name in string {subreddit}')
|
||||||
|
|||||||
Reference in New Issue
Block a user