Y
Y
Yury Bondaruk2021-08-07 08:05:56
Python
Yury Bondaruk, 2021-08-07 08:05:56

How to get track name from VK status?

Good afternoon! Today I started writing a bot for twitch. Messages are sent successfully, the only thing left is to get the track name from the status. In principle, the name itself is obtained, but the output occurs as a complete json. Is it possible to somehow extract the track name separately from this answer?

{'text': 'Track Title + Artist', 'audio': {'artist': 'Artist', 'id': 456240254, 'owner_id': 19607100, 'title': 'Title', 'duration': 25 , 'is_explicit': False, 'url': ' https://vk.com/mp3/audio_api_unavailable.mp3 ', 'date': 1627090666, 'is_hq': True, 'main_artists': [{'name': ' Liza Evans', 'domain': '9129861303334899376', 'id': '

session = vk.Session(access_token=token_user)
    api = vk.API(session ,v='5.92', lang='ru')
    status = api.status.get(user_id=19607100)


Help a mountain self-taught programmer, please!

PS I'm not a professional, I don't know about the code, I need it for myself. I ask knowledgeable people, thanks!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2021-08-07
@drnkwtr

Both title and author Title and author separately
audio = status["text"]

artist = status["audio"]["artist"]
title = status["audio"]["title"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question