From: Lane Campbell Date: Mon, 23 Mar 2020 20:20:05 +0000 (-0400) Subject: initial commit X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=698710c84e990dc58e4c9a4f7ec8b219328f7ab7;p=zoom-batch-downloader.git initial commit Tested as working. Moderately difficult to use without knowledge of Python. --- diff --git a/cloudlink.py b/cloudlink.py new file mode 100644 index 0000000..d379912 --- /dev/null +++ b/cloudlink.py @@ -0,0 +1,90 @@ +import requests +import datetime + +# Put your JWT token that you get from https://marketplace.zoom.us/ here. +JWT = '##########' + +# Put your USER ID that you get from the API. +USERID = '##########' + + +headers = { + 'Authorization': + 'Bearer {}'.format(JWT), + 'content-type': + 'application/json', + } + +PATH = '/Volumes/Ext3/Zoom/' + + + +def main(): + for year in range(2018,2022): + for month in range(1,13): + next_month = month + 1 + next_year = year + + if month == 12: + next_month = 1 + next_year = year + 1 + + start_date = datetime.datetime(year,month,1) + next_date = datetime.datetime(next_year,next_month,1) + + get_recording(start_date, next_date) + + +def get_recording(start_date, next_date): + + date_string = '%Y-%m-%d' + url = 'https://api.zoom.us/v2/users/{}/recordings?from={}&to={}&page_size=300&'.format( + USERID, + start_date.strftime(date_string), + next_date.strftime(date_string) + ) + + print(url) + + response = requests.get( + url, + headers=headers + ) + + data = response.json() + # print('page_count: ', data['page_count']) + # print('page_size: ', data['page_size']) + # print(len(data['meetings'])) + # print(data['from']) + # print(data['to']) + + for meeting in data['meetings']: + for record in meeting['recording_files']: + if record['status'] != 'completed': + continue + + download_recording( + record['download_url'], + record['recording_start'].replace(':','-') + ) + + +def download_recording(download_url, filename): + print(download_url) + download_access_url = '{}?access_token={}'.format(download_url, JWT) + print(download_access_url) + response = requests.get(download_access_url, stream=True) + local_filename = '{}{}.mp4'.format(PATH, filename) + + with open(local_filename, 'wb') as f: + for chunk in response.iter_content(chunk_size=8192): + print (len(chunk)) + f.write(chunk) + + +if __name__ == '__main__': + main() + + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..030f183 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,23 @@ +appnope==0.1.0 +backcall==0.1.0 +certifi==2019.11.28 +chardet==3.0.4 +decorator==4.4.2 +idna==2.9 +ipython==7.13.0 +ipython-genutils==0.2.0 +jedi==0.16.0 +parso==0.6.2 +pexpect==4.8.0 +pickleshare==0.7.5 +prompt-toolkit==3.0.4 +ptyprocess==0.6.0 +Pygments==2.6.1 +PyJWT==1.7.1 +requests==2.23.0 +six==1.14.0 +traitlets==4.3.3 +urllib3==1.25.8 +wcwidth==0.1.8 +wget==3.2 +zoomus==1.1.1