forked from rDrama/rDrama
stop undelete.pullpush.io triggering for subreddit links
parent
49a713fdaf
commit
db95791ad8
|
@ -168,7 +168,7 @@ def execute_snappy(post, v):
|
||||||
body += "\n\n"
|
body += "\n\n"
|
||||||
|
|
||||||
if post.url and not post.url.startswith('/') and not post.url.startswith(f'{SITE_FULL}/') and not post.url.startswith(SITE_FULL_IMAGES):
|
if post.url and not post.url.startswith('/') and not post.url.startswith(f'{SITE_FULL}/') and not post.url.startswith(SITE_FULL_IMAGES):
|
||||||
if post.url.startswith('https://old.reddit.com/r/'):
|
if reddit_post_permalink_regex.fullmatch(post.url):
|
||||||
rev = post.url.replace('https://old.reddit.com/', '')
|
rev = post.url.replace('https://old.reddit.com/', '')
|
||||||
rev = f"* [undelete.pullpush.io](https://undelete.pullpush.io/{rev})\n\n"
|
rev = f"* [undelete.pullpush.io](https://undelete.pullpush.io/{rev})\n\n"
|
||||||
elif post.url.startswith("https://old.reddit.com/user/"):
|
elif post.url.startswith("https://old.reddit.com/user/"):
|
||||||
|
@ -195,7 +195,7 @@ def execute_snappy(post, v):
|
||||||
if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n"
|
if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n"
|
||||||
if f'**[{title}]({href})**:\n\n' not in body:
|
if f'**[{title}]({href})**:\n\n' not in body:
|
||||||
addition = f'**[{title}]({href})**:\n\n'
|
addition = f'**[{title}]({href})**:\n\n'
|
||||||
if href.startswith('https://old.reddit.com/r/'):
|
if reddit_post_permalink_regex.fullmatch(href):
|
||||||
rev = href.replace('https://old.reddit.com/', '')
|
rev = href.replace('https://old.reddit.com/', '')
|
||||||
addition += f'* [undelete.pullpush.io](https://undelete.pullpush.io/{rev})\n\n'
|
addition += f'* [undelete.pullpush.io](https://undelete.pullpush.io/{rev})\n\n'
|
||||||
elif href.startswith('https://old.reddit.com/user/'):
|
elif href.startswith('https://old.reddit.com/user/'):
|
||||||
|
|
|
@ -248,6 +248,8 @@ reddit_to_vreddit_regex = re.compile('(^|>|")https:\/\/old.reddit.com\/([ru])\/'
|
||||||
#post search
|
#post search
|
||||||
subreddit_name_regex = re.compile('\w{2,25}', flags=re.A)
|
subreddit_name_regex = re.compile('\w{2,25}', flags=re.A)
|
||||||
|
|
||||||
|
#undelete.pullpush.io
|
||||||
|
reddit_post_permalink_regex = re.compile('https:\/\/old.reddit.com\/r\/\w{2,25}\/comments\/.*', flags=re.A)
|
||||||
|
|
||||||
###YOUTUBE
|
###YOUTUBE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue