Discord video support and more cleaning up

This commit is contained in:
some weird guy
2023-07-26 12:02:16 -07:00
parent 700b722736
commit 40355adef6
42 changed files with 24 additions and 396 deletions
+9
View File
@@ -812,6 +812,15 @@ class Post(models.Model):
except:
return False
return thing
def discord_vid(self):
try:
thing = re.search('(https?://)?(www\.)?(cdn)?(discordapp)\.(com)/attachments/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/(.+)', self.url).group(8)
if thing.endswith(".mp4") or thing.endswith(".webm"):
return thing
else:
return False
except:
return False
def has_line_trun(self):
if self.body and len(self.body.splitlines()) > 10:
return True