用户可以选择将他们的 Google 照片显示为 Google Drive 中的文件夹。在云端硬盘中删除会在照片中删除,反之亦然(相册和其他问题除外)。有关详细信息,请参阅https://support.google.com/photos/answer/6156103。
是否可以通过 API获取 PhotosmediaItem
资源和 Drivefiles
资源之间的对应关系?
我已经做了一件天真的事情:在两者中寻找匹配和嵌入的 id。没运气。API 的示例返回如下所示。(Ids 和 URLs 被轻微破坏以使其无法正常工作。)
示例媒体项:
{'id': 'APyCggKCjFW9fw_WJwaa5OUXE4Yp9nO2xk1Srkm9Eb-mA9l2pXRAy4oihnPfcAbez7',
'productUrl': 'https://photos.google.com/lr/album/APyCggJA4K-E0UOQMMAtnShqRVdP057VPEROpkqN2FYZcoVd4v8iz_3bu/photo/APyCggKCjFa8g5W9fw_WJwaaQObO2xk1Srk6Eb-mA9l2pXRAy4oihnPfcAbez7',
'baseUrl': 'https://lh3.googleusercontent.com/lr/AJ-EwvnNBVMKbifgSTnqRPr0qpKpiTE46ONto1IIq3ALLBMQFE14-PEzwTRRwuX0ym35ZIQFavk2HmbyMYtnzElMxoXxQpHOQqot1e-Uh1Y6WzcyPoRnenA1xDwwsnPugsnK0vRdoEPiBMNF25NTnNZ8m7F4Za0Xd-b1FbIYow4BrIFAlKwPfv5g8-tk8CaNoOOTmL5TVoDfJwcOyD7McFdOm4dN-731itNxaYonVF5WVw66-aqQxKRvd-P6HFZ7b_bQQxB9foQLFdOLqVWmF2Jpp5ep801--ekkZF7wSQw-7obcqXLfqi9ieW_OWSjMOh77nkqMwdQ9dhXJ-XgfdDsuzZRrft8338nKsiGyt9EgNT4a26k7A1y9G2phCKFYO7O8Rwhs_uRuX4Lc6c3Tbng_VEt5cTiWO_OiMddGyyWRR4d9gWLTAYeNTDqFHO_0ZhEYjcwbYmBvzgY7Pg1wOxtPj3WtZXXRf5AvpKEOmhHiaIeEh0rwFAbde0E1NBbB7tNm4YOq_YIIxjKnaN4v0OsghB6ah3nVNwVxIszrTCR6DgGCFOCEgJyETLLAmi8aUDDhoyzGqCtpiPZ3FeFozIeimeGbvLTiefjo-39Fiiuc7_vSKFkgOAnDq-gDhRDvwO4SoPm4JrD_4YbTkb_1rmf8Iv26lCplEJJxM4g0_b6MrvE4JEI5uyOf01Rk_Am5v7s7piOdsmAHr7pKVorY3EhU5ezNAgzye9V2Is9cuK2ALQOG17UyH9sxWlHPxtDLKV2Ur8gfem0bqzO2WNjMn_rX_Q27W',
'mimeType': 'image/jpeg',
'mediaMetadata': {'creationTime': '2018-12-25T15:28:26Z',
'width': '2448',
'height': '3264',
'photo': {'cameraMake': 'Apple',
'cameraModel': 'iPhone 6 Plus',
'focalLength': 4.15,
'apertureFNumber': 2.2,
'isoEquivalent': 32}},
'filename': 'IMG_0924.JPG'}
示例文件:
{'kind': 'drive#file',
'id': '1XXkAo-AL7PXBXNpS27cGBCsHvHOaCtXBgQ',
'name': 'IMG_0924.JPG',
'mimeType': 'image/jpeg',
'description': '',
'starred': False,
'trashed': False,
'explicitlyTrashed': False,
'parents': ['jpWRoFkPQ0mg'],
'spaces': ['photos', 'drive'],
'version': '2',
'webContentLink': 'https://drive.google.com/a/bogus.com/uc?id=1XXkAo-AL77cGBCsHvHOaCtXBgQ&export=download',
'webViewLink': 'https://drive.google.com/a/bogus.com/file/d/1XXkAo-AL77cGBCsHvHOaCtXBgQ/view?usp=drivesdk',
'iconLink': 'https://drive-thirdparty.googleusercontent.com/16/type/image/jpeg',
'hasThumbnail': True,
'thumbnailLink': 'https://lh3.googleusercontent.com/zxSXO-GJkKmVVejNzEYreyx7_wEddrq2VPWsVSCFRdRfiVdI5--oWm00=s220',
'thumbnailVersion': '1',
'viewedByMe': False,
'createdTime': '2018-12-25T15:28:26.000Z',
'modifiedTime': '2019-01-06T16:56:08.000Z',
'modifiedByMeTime': '2019-01-06T16:56:08.000Z',
'modifiedByMe': True,
'owners': [{'kind': 'drive#user',
'displayName': 'Reece Hart',
'photoLink': 'https://lh5.googleusercontent.com/-QYk9j/AAAAAAI/AAAAOFo/PC9sT/s64/photo.jpg',
'me': True,
'permissionId': '03329584261458389005',
'emailAddress': 'reece@bogus.com'}],
'lastModifyingUser': {'kind': 'drive#user',
'displayName': 'Reece Hart',
'photoLink': 'https://lh5.googleusercontent.com/-QYk9i9j/AAAAAAI/AAAAOFo/PC9j/s64/photo.jpg',
'me': True,
'permissionId': '03329584261458389005',
'emailAddress': 'reece@bogus.com'},
'shared': False,
'ownedByMe': True,
'capabilities': {'canAddChildren': False,
'canChangeCopyRequiresWriterPermission': True,
'canChangeViewersCanCopyContent': True,
'canComment': True,
'canCopy': True,
'canDelete': True,
'canDownload': True,
'canEdit': True,
'canListChildren': False,
'canMoveItemIntoTeamDrive': False,
'canReadRevisions': True,
'canRemoveChildren': False,
'canRename': True,
'canShare': True,
'canTrash': True,
'canUntrash': True},
'viewersCanCopyContent': True,
'copyRequiresWriterPermission': False,
'writersCanShare': True,
'permissions': [{'kind': 'drive#permission',
'id': '03329584261458389005',
'type': 'user',
'emailAddress': 'reece@bogus.com',
'role': 'owner',
'displayName': 'Reece Hart',
'photoLink': 'https://lh5.googleusercontent.com/-QYk9i9/AAAAA/AAAA/PC9jsT/s64/photo.jpg',
'deleted': False}],
'permissionIds': ['03329584261'],
'originalFilename': 'IMG_0924.JPG',
'fullFileExtension': 'JPG',
'fileExtension': 'JPG',
'md5Checksum': '7ffdb3f36ba89bcad4b7e3b40a6ef356',
'size': '116216',
'quotaBytesUsed': '0',
'headRevisionId': '1gSdsharFji-NH3dDz9AitkOycA',
'imageMediaMetadata': {'width': 1200,
'height': 1600,
'rotation': 0,
'location': {'latitude': 37.72585277777778,
'longitude': -122.41243611111112,
'altitude': 1075.620606060606},
'colorSpace': 'sRGB'},
'isAppAuthorized': False}