diff --git a/config.py b/config.py index 075a1de..187b296 100644 --- a/config.py +++ b/config.py @@ -32,7 +32,7 @@ VK_APP_ID = os.environ.get('VK_APP_ID', '2685278') # Kate mobile AUDIO_URL = os.environ.get('AUDIO_URL', 'http://thatmusic.akentev.com/id/{owner_id}/{audio_id}') AUDIO_ACCESS_URL = os.environ.get('AUDIO_ACCESS_URL', - 'http://thatmusic.akentev.com/access_id/{token}/{owner_id}/{audio_id}') + 'http://thatmusic.akentev.com/access_id/{token}/{owner_id}/{audio_id}/{access_key}') TOKEN_REFRESH_URL = os.environ.get('TOKEN_REFRESH_URL', 'http://thatmusic.akentev.com/refresh') AUDIO_SEARCH_URL = os.environ.get('AUDIO_SEARCH_URL', 'https://thatmusic.akentev.com/search/') AUDIO_PROXY_URL = os.environ.get('AUDIO_PROXY_URL', 'https://thatmusic.akentev.com/proxy/') diff --git a/vk_messages.py b/vk_messages.py index 7562e4b..3a5907c 100644 --- a/vk_messages.py +++ b/vk_messages.py @@ -802,14 +802,15 @@ async def process_attachment(attachment, token=None): return {'content': audio, 'type': 'audio'} except: pass - if AUDIO_ACCESS_URL: if token: try: with aiohttp.ClientSession() as session: r = await session.request('GET', AUDIO_ACCESS_URL.format(token=token, owner_id=attachment[atype]['owner_id'], - audio_id=attachment[atype]['id'])) + audio_id=attachment[atype]['id'], + access_key=attachment[atype].get( + 'access_key', ''))) if r.status != 200: raise Exception audio = await r.read()