This commit is contained in:
danamir
2023-06-26 02:53:02 +03:00
parent 0957c4496b
commit f3880382ae

29
main.py
View File

@@ -1,12 +1,39 @@
import vk_api import vk_api
import json
vk_session = vk_api.VkApi('+79167941799', 'cjghjvfn_1q2w3e') vk_session = vk_api.VkApi('+79167941799', 'cjghjvfn_1q2w3e')
vk_session.auth() vk_session.auth()
vk = vk_session.get_api() vk = vk_session.get_api()
"""
izbr = vk.fave.get() izbr = vk.fave.get()
query_length = izbr['count'] 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)