Video privacy fix

This commit is contained in:
Kylmakalle 2017-06-24 22:33:12 +03:00
parent 7b41a06898
commit 7ff2fc4c95

7
bot.py
View File

@ -255,7 +255,7 @@ def send_video(message, userid, group):
files = {'video_file': openedfile} files = {'video_file': openedfile}
if group: if group:
attachment = vk.API(session).video.save(privacy_view='all') attachment = vk.API(session).video.save(is_private=1)
fileonserver = ujson.loads(requests.post(attachment['upload_url'], fileonserver = ujson.loads(requests.post(attachment['upload_url'],
files=files).text) files=files).text)
video = 'video{}_{}'.format(attachment['owner_id'], attachment['owner_id']['video_id']) video = 'video{}_{}'.format(attachment['owner_id'], attachment['owner_id']['video_id'])
@ -264,10 +264,7 @@ def send_video(message, userid, group):
else: else:
vk.API(session).messages.send(chat_id=userid, attachment=video) vk.API(session).messages.send(chat_id=userid, attachment=video)
else: else:
try: attachment = vk.API(session).video.save(is_private=1)
attachment = vk.API(session).video.save(privacy_view=userid)
except:
attachment = vk.API(session).video.save(privacy_view='all')
fileonserver = ujson.loads(requests.post(attachment['upload_url'], fileonserver = ujson.loads(requests.post(attachment['upload_url'],
files=files).text) files=files).text)
video = 'video{}_{}'.format(attachment['owner_id'], attachment['vid']) video = 'video{}_{}'.format(attachment['owner_id'], attachment['vid'])