Closed ctang1994 closed 4 years ago
Hi,
Thanks for submitting this issue and submitting your revised code - looks great!
I've known about the API changes for a while now, but haven't got around to updating the repo with my new code. I've pushed my latest changes to the script, which should allow you to download more than 30 days of recordings.
Thanks!
First of all, thanks for your code!
When I was running the code and try to transfer zoom cloud storage to local storage for back-up, it always downloads the recent One month's recording. After a lot of researches and read the development document from zoom: https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingslist I found that the default start date is 30 days before the current date. Therefore, I tried to make a tiny modification for the original code:
(I have ignored the previous codes to hide my api-key and secret-key) (The modification has been marked as BOLD below)
`# JWT_TOKEN now lives in appenv.py ACCESS_TOKEN = 'Bearer ' + JWT_TOKEN AUTHORIZATION_HEADER = {'Authorization': ACCESS_TOKEN}
API_ENDPOINT_USER_LIST = 'https://api.zoom.us/v2/users/'
RECORDING_END_DATE = '2020-05-20' RECORDING_START_DATE = '2020-04-21' # Start date in 'yyyy-mm-dd' format (within 6 month range) DOWNLOAD_DIRECTORY = 'D:/ZOOM Backup/' COMPLETED_MEETING_IDS_LOG = 'completed-downloads-backup.log' COMPLETED_MEETING_IDS = set()
define class for text colouring and highlighting
class color: PURPLE = '\033[95m' CYAN = '\033[96m' DARKCYAN = '\033[36m' BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' BOLD = '\033[1m' UNDERLINE = '\033[4m' END = '\033[0m'
def API_ENDPOINT_RECORDING_LIST(email): API_ENDPOINT = 'https://api.zoom.us/v2/users/' + email + '/recordings' return API_ENDPOINT
def get_credentials(host_id, page_number, rec_start_date, rec_end_date): return { 'host_id': host_id, 'page_number': page_number, 'from': rec_start_date, 'to': rec_end_date }
def get_user_ids():
get total page count, convert to integer, increment by 1
def format_filename(recording, file_type): uuid = recording['uuid'] topic = recording['topic'].replace('/', '&') meeting_time = parse(recording['start_time'])
def get_downloads(recording): downloads = [] for download in recording['recording_files']: file_type = download['file_type'] download_url = download['download_url'] + "?access_token=" + JWT_TOKEN # must append JWT token to download_url downloads.append((file_type, download_url,)) return downloads
def list_recordings(email): post_data = get_credentials(email, 1, RECORDING_START_DATE, RECORDING_END_DATE) response = requests.get(url=API_ENDPOINT_RECORDING_LIST(email), headers=AUTHORIZATION_HEADER, params=post_data) recordings_data = response.json() total_records = recordings_data['total_records'] page_count = recordings_data['page_count'] next_page = recordings_data['next_page_token']
def download_recording(download_url, email, filename): dl_dir = os.sep.join([DOWNLOAD_DIRECTORY, email]) full_filename = os.sep.join([dl_dir, filename]) os.makedirs(dl_dir, exist_ok=True) response = requests.get(download_url, stream=True)
def load_completed_meeting_ids(): try: with open(COMPLETED_MEETING_IDS_LOG, 'r') as fd: for line in fd: COMPLETED_MEETING_IDS.add(line.strip()) except FileNotFoundError: print("Log file not found. Creating new log file: ", COMPLETED_MEETING_IDS_LOG) print('')
def handler(signal_received, frame):
handle cleanup here
MAIN
def main():
clear the screen buffer
'''.format(APP_VERSION))
if name == "main":
tell Python to run the handler() function when SIGINT is recieved
Finally, thanks~