D
D
Denis Ka2018-09-22 17:44:46
Python
Denis Ka, 2018-09-22 17:44:46

How to control video download via VKontakte API?

For personal use, I tried to write a python script that loads all video files from a folder (and subfolders) into a user (personal) Vkontakte album.
Can you tell me how to check if the upload was successful? And what could cause her to break?
The files are relatively small (no more than 100 MB)
After running my script, I found that only about a fifth of all the files were loaded ...
The code is something like this:

import vk_api
import os
vk_session = vk_api.VkApi(login, password)
vk_session.auth(token_only=True)
album_id = 888888
up = vk_api.VkUpload(vk_session)

path = '/home/___'
for root, dirs, files in os.walk(path):
    for file in files:
        num = os.path.relpath(root, path)
        video_file = os.path.join(root, file)
        name = num + file
        up.video(video_file = video_file, name = name, album_id = album_id, no_comments=True)

num is needed because there are files with the same name, but they are located in different folders

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question