uiuewhdiw

remotes/1693045480750635534/spooky-22
fireworks88 2021-10-27 11:15:11 +02:00
parent 8c9b8809d3
commit 02f83e46ca
1 changed files with 6 additions and 2 deletions

View File

@ -865,9 +865,13 @@ def submit_post(v):
# archive other urls in post
url_regex = '<a href=\"(https?://[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">([^\"]+)</a>'
print(new_post.body_html)
for url_match in re.finditer(url_regex, new_post.body_html, flags=re.M|re.I):
_body = new_post.body_html
for url_match in re.finditer(url_regex, _body, flags=re.M|re.I):
href = url_match.group(1)
if not href:
continue
print(href)
title = url_match.group(2)
body += f'**[{title}]({href})**:\n\n'