How to download a specific revision of google slides file?

32 Views Asked by At

i'm trying to get a specific version of google slides, for that i first of all get all revisions:

creds = ServiceAccountCredentials.from_json_keyfile_name(credentials_path)
drive_service = build("drive", "v2", credentials=creds)
revs = drive_service.revisions().list(fileId=presentation_id).execute()
revs_items = revs.get('items')

Then in variable revs_items contained all revisions, with all fields, including exportLinks with various versions of formats for export, but all of that links leads to downloading of latest version of file.

Revisions dicts looks like this:

{'etag': '"HYVl_XolCtT8iAhJReRS6HnNpU4"',
 'exportLinks': {'application/pdf': 'my_link&revision=2682&exportFormat=pdf',
                 'application/vnd.oasis.opendocument.presentation': 'my_link&revision=2682&exportFormat=odp',
                 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'my_link&revision=2682&exportFormat=pptx',
                 'text/plain': 'my_link&revision=2682&exportFormat=txt'},
 'id': '2682',
 'kind': 'drive#revision',
 'lastModifyingUser': {'displayName': '',
                       'isAuthenticatedUser': False,
                       'kind': 'drive#user'},
 'lastModifyingUserName': '',
 'mimeType': 'application/vnd.google-apps.presentation',
 'modifiedDate': '2021-10-29T09:02:29.011Z',
 'published': False,
 'selfLink': 'https://www.googleapis.com/drive/v2/files/my_link/revisions/2682'}

{'etag': '"tYdKGWZBKi1nzFMg_Rc_y4DMuEE"',
 'exportLinks': {'application/pdf': 'https://docs.google.com/feeds/download/presentations/Export?id=my_link&revision=2688&exportFormat=pdf',
                 'application/vnd.oasis.opendocument.presentation': 'https://docs.google.com/feeds/download/presentations/Export?id=my_link&revision=2688&exportFormat=odp',
                 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'https://docs.google.com/feeds/download/presentations/Export?id=my_link&revision=2688&exportFormat=pptx',
                 'text/plain': 'https://docs.google.com/feeds/download/presentations/Export?id=my_link&revision=2688&exportFormat=txt'},
 'id': '2688',
 'kind': 'drive#revision',
 'lastModifyingUser': ''},
 'lastModifyingUserName': '',
 'mimeType': 'application/vnd.google-apps.presentation',
 'modifiedDate': '2024-01-17T16:43:40.518Z',
 'published': False,
 'selfLink': 'https://www.googleapis.com/drive/v2/files/my_link/revisions/2688'}

Is there a way to download a specific version of file or google banned it?

0

There are 0 best solutions below