-
Notifications
You must be signed in to change notification settings - Fork 3
/
zoom_files_delete.py
55 lines (45 loc) · 2.11 KB
/
zoom_files_delete.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
# This script get videos from Zoom and makes the backup into a vimeo account using pull approach
import os
import sys
import requests
import urllib
import json
from utils import Utils
class Zoom :
def delete_zoom_files(self,records):
utils = Utils()
query = {"action": "trash"}
headers = {'authorization': 'Bearer '+utils.zoom_token}
print('\n'+' Moving to trash files '.center(100, ':'))
for record in records:
url = "https://api.zoom.us/v2/meetings/{meeting_id}/recordings/{record_id}"
url = url.format(meeting_id=urllib.parse.quote(
record['meeting_uuid']), record_id=urllib.parse.quote(record['record_id']))
if record['file_extension'] == 'MP4' or record['file_extension'] == 'VTT':
if record['vimeo_status'] == 'active' or record['vimeo_status'] == 'available' or record['vimeo_status'] == 'transcoding' or record['vimeo_status'] == 'transcode_starting':
# if utils.input_type == 2 and (record['status']=='downloaded' or record['vimeo_status']=='available'):
response = requests.request("DELETE", url, headers=headers, params=query)
if response.status_code != 204:
json_response = json.loads(response.content)
print(json_response)
else:
print(' Deleting file {filename} in meeting {meetingid} '.format(
filename=record['file_name'], meetingid=record['meeting_id']).center(100, ':'))
record['status'] = 'deleted'
else:
# if utils.input_type == 2 and (record['status']=='downloaded' or record['vimeo_status']=='available'):
response = requests.request("DELETE", url, headers=headers, params=query)
if response.status_code != 204:
json_response = json.loads(response.content)
print(json_response)
else:
print(' Deleting file {filename} in meeting {meetingid} '.format(
filename=record['file_name'], meetingid=record['meeting_id']).center(100, ':'))
record['status'] = 'deleted'
return records
# if __name__ == "__main__":
# utils = Utils()
# files = utils.get_records(sys.argv, 'zoom_files_delete.py')
# files = delete_zoom_files(files)
# utils.save_csv(files, utils.output_file)