uiuewhdiw
This commit is contained in:
parent
5e0f5416ab
commit
31989a96f8
1 changed files with 6 additions and 2 deletions
|
@ -865,9 +865,13 @@ def submit_post(v):
|
||||||
|
|
||||||
# archive other urls in post
|
# archive other urls in post
|
||||||
url_regex = '<a href=\"(https?://[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">([^\"]+)</a>'
|
url_regex = '<a href=\"(https?://[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">([^\"]+)</a>'
|
||||||
print(new_post.body_html)
|
_body = new_post.body_html
|
||||||
for url_match in re.finditer(url_regex, new_post.body_html, flags=re.M|re.I):
|
for url_match in re.finditer(url_regex, _body, flags=re.M|re.I):
|
||||||
href = url_match.group(1)
|
href = url_match.group(1)
|
||||||
|
|
||||||
|
if not href:
|
||||||
|
continue
|
||||||
|
|
||||||
print(href)
|
print(href)
|
||||||
title = url_match.group(2)
|
title = url_match.group(2)
|
||||||
body += f'**[{title}]({href})**:\n\n'
|
body += f'**[{title}]({href})**:\n\n'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue