T
T
Timebird2019-06-26 13:36:52
Python
Timebird, 2019-06-26 13:36:52

How to display the total number of entries in a VK group?

Good afternoon!
Please tell me how to display the total number of group entries in VK using wall.get in Python (as of June 2019)? You just need this number.
I found some examples, but due to changes in the API, they do not work now.

def vk_download(method, parameters, token = token):
    url = 'https://api.vk.com/method/'+method+'?'+parameters+'&access_token='+str(token)
    response = requests.get(url) 
    return(response.json())


n = vk_download('wall.get','owner_id=-123456789')['response'][0] 
print('В группе целых', n, 'постов')

It turns out something like:

In a group of integers {'count': 9619, 'items': [{'id': 51999, 'from_id': -26610299, 'owner_id': -26610299, 'date': 1560444551, 'marked_as_ads': 0, 'post_type ': 'post', 'text': 'IMPORTANT INFORMATION, which may be useful to those who wish to purchase the official book of M. ‼\n\n⏺ The new batch will be released at the end of July (more like the beginning of August, I will be on vacation in July)\n⏺ The content of the new batch will not change,
...
'comments': {'count': 0}, 'likes': {'count': 805}, 'reposts': {'count': 37}, 'views': { 'count': 33787}}]} posts

Tell me please - how to fix it?
upd: thanks guys! Works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-06-26
@Timebird

n = vk_download('wall.get','owner_id=-123456789')['response']['count']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question