ricardorodrigues-ca / zoom-recording-downloader

Downloads and organizes all cloud recordings from your Zoom Business account
MIT License
127 stars 65 forks source link

JWT will be deprecated from Zoom API #22

Closed meadow-kun closed 1 year ago

meadow-kun commented 2 years ago
Screenshot 2022-09-16 at 13 29 58

Just a heads up that this implementation will run into issues by June 2023.

Cloned today, worked flawlessly. Thank you!

alexknowshtml commented 1 year ago

Has anybody successfully updated this to use Server-to-server instead of JWT?

freelimiter commented 1 year ago

Has anybody successfully updated this to use Server-to-server instead of JWT?

Yes! But doing more tests.

alexknowshtml commented 1 year ago

@freelimiter let me know if I can help test!

freelimiter commented 1 year ago

``def load_access_token():

url = "https://zoom.us/oauth/token?grant_type=account_credentials&account_id=" + ACCOUNT_ID

client_cred = CLIENT_ID + ":" + CLIENT_SECRET
client_cred_base64_string = base64.b64encode(client_cred.encode('utf-8')).decode('utf-8')

headers = {
  'Authorization': 'Basic ' + client_cred_base64_string,
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers)

jdata = json.loads(response.text)

global ACCESS_TOKEN
global AUTHORIZATION_HEADER

ACCESS_TOKEN = jdata["access_token"]
AUTHORIZATION_HEADER = {'Authorization': 'Bearer ' + ACCESS_TOKEN,
                        'Content-Type': 'application/json'}

``

freelimiter commented 1 year ago

I'm such a noob. sorry. Add ACCOUNT_ID, CLIENT_ID, CLIENT_SECRET at the top where the global vars are.

Then in the main function, insert load_access_token() before load_completed_meeting_ids()

freelimiter commented 1 year ago

also import base64

freelimiter commented 1 year ago

@freelimiter let me know if I can help test!

Does it work for you?

alexknowshtml commented 1 year ago

Giving this a go tomorrow morning, will let you know. Thank you for sharing!

alexknowshtml commented 1 year ago

@freelimiter - followed your instructions, got this:

Traceback (most recent call last):
  File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 319, in <module>
    main()
  File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 264, in main
    load_access_token()
  File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 81, in load_access_token
    jdata = json.loads(response.text)
NameError: name 'json' is not defined

I added import json and it fixed that error, but replaced it with this:

Traceback (most recent call last):
  File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 320, in <module>
    main()
  File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 265, in main
    load_access_token()
  File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 87, in load_access_token
    ACCESS_TOKEN = jdata["access_token"]
KeyError: 'access_token'
freelimiter commented 1 year ago

Add “import json” at the top

On Thu, May 18, 2023 at 5:19 AM Alex Hillman @.***> wrote:

@freelimiter https://github.com/freelimiter - followed your instructions, getting this:

Traceback (most recent call last): File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 319, in main() File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 264, in main load_access_token() File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 81, in load_access_token jdata = json.loads(response.text) NameError: name 'json' is not defined

— Reply to this email directly, view it on GitHub https://github.com/ricardorodrigues-ca/zoom-recording-downloader/issues/22#issuecomment-1552971436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANWRK6MVBFSPJO3VDP6DIDXGYHUNANCNFSM6AAAAAAQOH3ICY . You are receiving this because you were mentioned.Message ID: @.*** .com>

freelimiter commented 1 year ago

Ok May need some error checking in that part of the code. But did you create a new App in zoom for Server to server OAuth and then filled out all credentials in the global variables?

On Thu, May 18, 2023 at 6:20 AM Arvin P @.***> wrote:

Add “import json” at the top

On Thu, May 18, 2023 at 5:19 AM Alex Hillman @.***> wrote:

@freelimiter https://github.com/freelimiter - followed your instructions, getting this:

Traceback (most recent call last): File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 319, in main() File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 264, in main load_access_token() File "/Users/alexhillman/Desktop/zoom-recording-downloader/zoom-recording-downloader.py", line 81, in load_access_token jdata = json.loads(response.text) NameError: name 'json' is not defined

— Reply to this email directly, view it on GitHub https://github.com/ricardorodrigues-ca/zoom-recording-downloader/issues/22#issuecomment-1552971436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANWRK6MVBFSPJO3VDP6DIDXGYHUNANCNFSM6AAAAAAQOH3ICY . You are receiving this because you were mentioned.Message ID: <ricardorodrigues-ca/zoom-recording-downloader/issues/22/1552971436@ github.com>

alexknowshtml commented 1 year ago

Good news! I didn't realize that I hadn't finished setting up the S2S Oauth App, I just copied the credentials from the first panel.

While completing the app creation, I did some guess and check and got the script working by adding the scopes for downloads, users, and accounts. Once I had them done, the app worked again! Thanks so much for this.

Monosnap M2 Mini 2023-05-18 10-08-37

Any idea which ones are actually needed, so I can remove the rest?

freelimiter commented 1 year ago

That great! It’s all about trial and error at this point. Glad it’s working out for you!

On Thu, May 18, 2023 at 7:10 AM Alex Hillman @.***> wrote:

Good news! I didn't realize that I hadn't finished setting up the S2S Oauth App, I just copied the credentials from the first panel.

While completing the app creation, I did some guess and check and got the script working by adding the scopes for downloads, users, and accounts. Once I had them done, the app worked again! Thanks so much for this. [image: Monosnap M2 Mini 2023-05-18 10-08-37] https://user-images.githubusercontent.com/3707/239255986-83dbdb8f-eaf4-44a7-8bf8-974b0918786a.png

Any idea which ones are actually needed, so I can remove the rest?

— Reply to this email directly, view it on GitHub https://github.com/ricardorodrigues-ca/zoom-recording-downloader/issues/22#issuecomment-1553120539, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANWRKYD4FGUTQD2ZBEBF5DXGYUVXANCNFSM6AAAAAAQOH3ICY . You are receiving this because you were mentioned.Message ID: @.*** .com>

freelimiter commented 1 year ago

Everything good so far? Please make sure to review the downloaded files and the videos are actually playable. Had an issue where I had activated the passcode for sharing recordings and the downloads were unplayable.

alexknowshtml commented 1 year ago

i checked and all of the latest videos it downloaded look good and playable. Works like a charm! thanks again.

Xac1 commented 1 year ago

Hi. All works! Thank you!

risdian commented 1 year ago

care to share the source code?

freelimiter commented 1 year ago

read this entire thread.

care to share the source code?

neylwalecki commented 1 year ago

Hi folks, I've been using this script for a while and it has saved my life! Thanks for the update @freelimiter I've just submitted my first pull request ever, with the updated code. Hope I've done everything right. :-)

freelimiter commented 1 year ago

Oh awesome! I was going to do it but got busy. Thanks!!!

neylwalecki commented 1 year ago

@risdian you can check the changes/new code here https://github.com/ricardorodrigues-ca/zoom-recording-downloader/pull/37/files

risdian commented 1 year ago

@risdian you can check the changes/new code here https://github.com/ricardorodrigues-ca/zoom-recording-downloader/pull/37/files

i already done the code. thanks to @freelimiter. thank you all.

freelimiter commented 1 year ago

also added new function called delete_meeting. You can call this function after "skipping already downloaded" and the "# if successful, write the ID of this recording to the completed file". hope that makes sense.

def delete_meeting(meeting_id):

Delete the recording

delete_url = "https://api.zoom.us/v2/meetings/{}/recordings".format(meeting_id)
response = requests.delete(delete_url, headers=AUTHORIZATION_HEADER)

if response.status_code == 204:
    print("Successfully deleted recording for meeting: {}".format(meeting_id))
else:
    print("Failed to delete recording for meeting: {}. Response: {}".format(meeting_id, response.text))
ricardorodrigues-ca commented 1 year ago

Script now uses Server-to-Server OAuth authentication, and updated README.md to reflect new instructions.