Fixed all audio methods due to latest VK changes

This commit is contained in:
2019-04-16 15:45:25 -05:00
parent 5f224a077c
commit 4f3bb6ac93
4 changed files with 20 additions and 5 deletions

View File

@@ -72,4 +72,16 @@ def clean_text(text):
""" Clean text, removing all unneeded HTMl and converting HTML represented characters in their unicode counterparts."""
text = detect_users(text)
text = html.unescape(text)
return text
return text
def transform_audio_url(url):
""" Transforms the URL offered by VK to the unencrypted stream so we can still play it. """
if "vkuseraudio.net" not in url and "index.m3u8" not in url:
return url
url = url.replace("/index.m3u8", ".mp3")
parts = url.split("/")
if "/audio" not in url:
url = url.replace("/"+parts[-2], "")
else:
url = url.replace("/"+parts[-3], "")
return url