From f3880382ae1ebe549ff7d96e05aec78cbba39a95 Mon Sep 17 00:00:00 2001 From: danamir Date: Mon, 26 Jun 2023 02:53:02 +0300 Subject: [PATCH] add data --- main.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 345c8a2..356962a 100644 --- a/main.py +++ b/main.py @@ -1,12 +1,39 @@ import vk_api +import json vk_session = vk_api.VkApi('+79167941799', 'cjghjvfn_1q2w3e') vk_session.auth() vk = vk_session.get_api() +""" izbr = vk.fave.get() query_length = izbr['count'] -print(izbr['items'][0]['post']) + +#print(izbr['items'][i]['post']['attachments'][0]['link']['title']) + + +print(len(izbr['items'])) +""" + +tools = vk_api.VkTools(vk_session) + +fave = tools.get_all('fave.get', 100) + + +""" +if fave['count']: + for i in range(fave['count']): + print(i) + if fave['items'][i]['type'] == 'article': + print(fave['items'][i]['article']['view_url']) + elif fave['items'][i]['type'] == 'post': + print(fave['items'][i]['post']) +""" + + +json_string = json.dumps(fave) +with open('json_data.json', 'w') as outfile: + outfile.write(json_string) \ No newline at end of file