forked from rDrama/rDrama
no need to use regex
parent
e29b0f37ee
commit
e84f42d34a
|
@ -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 reddit_post_permalink_regex.fullmatch(post.url):
|
if post.url.startswith('https://old.reddit.com/r/') and '/comments/' in 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/"):
|
||||||
|
@ -196,7 +196,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 reddit_post_permalink_regex.fullmatch(href):
|
if href.startswith('https://old.reddit.com/r/') and '/comments/' in 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,8 +248,6 @@ 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