forked from MarseyWorld/MarseyWorld
only add ?context=8 to comment links
parent
03b33deb26
commit
5e6ebb3599
|
@ -232,6 +232,7 @@ asset_image_link_regex = re.compile(f"https:\/\/(i\.)?{SITE}\/assets\/images\/[\
|
|||
#sanitizing
|
||||
reddit_mention_regex = re.compile('(?<![\w/])\/?(([ruRU])\/[\w-]{2,25})' + NOT_IN_CODE_OR_LINKS, flags=re.A)
|
||||
reddit_domain_regex = re.compile("(^|\s|\()https?:\/\/(reddit\.com|(?:(?:[A-z]{2})(?:-[A-z]{2})" "?|www|new)\.reddit\.com|libredd\.it|reddit\.lol)\/(u\/|user\/|(r\/\w{2,25}\/)?comments\/|r\/\w{2,25}\/?$)", flags=re.A)
|
||||
reddit_comment_link_regex = re.compile("https:\/\/old.reddit.com\/r\/\w{2,25}\/comments(\/\w+){3}\/?", flags=re.A)
|
||||
|
||||
#gevent
|
||||
reddit_s_url_regex = re.compile("https:\/\/reddit.com\/r\/\w{2,25}\/s\/\w{10}", flags=re.A)
|
||||
|
|
|
@ -782,7 +782,7 @@ def normalize_url(url):
|
|||
domain = parsed_url.netloc
|
||||
qd = parse_qs(parsed_url.query, keep_blank_values=True)
|
||||
filtered = {k: val for k, val in qd.items() if is_whitelisted(domain, k)}
|
||||
if domain == 'old.reddit.com':
|
||||
if domain == 'old.reddit.com' and reddit_comment_link_regex.fullmatch(url):
|
||||
filtered['context'] = 8
|
||||
new_url = ParseResult(scheme="https",
|
||||
netloc=parsed_url.netloc,
|
||||
|
|
Loading…
Reference in New Issue