mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-08-04 21:16:07 -04:00
Added toot deletion and opening URLS in the browser
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import re
|
||||
from html.parser import HTMLParser
|
||||
|
||||
url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ \\n\\t]*")
|
||||
|
||||
class HTMLFilter(HTMLParser):
|
||||
text = ""
|
||||
def handle_data(self, data):
|
||||
@@ -40,4 +43,7 @@ def get_media_urls(toot):
|
||||
for media in toot.media_attachments:
|
||||
if media.get("type") == "audio" or media.get("type") == "video":
|
||||
urls.append(media.get("url"))
|
||||
return urls
|
||||
return urls
|
||||
|
||||
def find_urls(text):
|
||||
return url_re.findall(html_filter(text))
|
Reference in New Issue
Block a user