需要从Google照片中删除照片。

huangapple go评论96阅读模式
英文:

Oops: Need to delete photos from Google Photos

问题

I've used to Google Photos API to back up a bunch of old photos (31,748 of them) on my local server to Google Photos. Unfortunately, I messed up the process. Now I need to delete all 31,748 photos. (I only want to delete the photos that this app created, not all of my photos.) Unfortunately it appears from various previous questions here that Google Photos API does not have a method for deleting (and they have in fact closed all such requests, saying this is not what the API is intended for!). I'm wondering if anyone has any creative ideas? I have the IDs of all the photos I want to remove.

英文:

I've used to Google Photos API to back up a bunch of old photos (31,748 of them) on my local server to Google Photos. Unfortunately, I messed up the process. Now I need to delete all 31,748 photos. (I only want to delete the photos that this app created, not all of my photos.) Unfortunately it appears from various previous questions here that Google Photos API does not have a method for deleting (and they have in fact closed all such requests, saying this is not what the API is intended for!). I'm wondering if anyone has any creative ideas? I have the IDs of all the photos I want to remove.

答案1

得分: 1

I came up in an imperfect solution. I search for all photos that the app uploaded using:

nextpagetoken = ''
itemids = []
while True:
  results = service.mediaItems().search(
    body={'filters': {'excludeNonAppCreatedData': True}, 'pageSize': 100, 'pageToken': nextpagetoken}).execute()
  items = results.get('mediaItems', [])
  for item in items:
    itemids.append(item['id'])
  nextpagetoken = results.get('nextPageToken', '')
  if not nextpagetoken:
    break

Then I take groups of 500 of them and add them to an album. Those albums are small enough to open in my browser without issue (unlike the 20,000-picture album). Then I just select the first one, scroll to the bottom, hold Shift and select the last one, then hit the Trash button and confirm. It takes about 30 seconds per 500 photos.

英文:

I came up in an imperfect solution. I search for all photos that the app uploaded using:

nextpagetoken = ''
itemids = []
while True:
  results = service.mediaItems().search(
    body={'filters': {'excludeNonAppCreatedData': True}, 'pageSize': 100, 'pageToken': nextpagetoken}).execute()
  items = results.get('mediaItems', [])
  for item in items:
    itemids.append(item['id'])
  nextpagetoken = results.get('nextPageToken', '')
  if not nextpagetoken:
    break

Then I take groups of 500 of them and add them to an album. Those albums are small enough to open in my browser without issue (unlike the 20,000-picture album). Then I just select the first one, scroll to the bottom, hold Shift and select the last one, then hit the Trash button and confirm. It takes about 30 seconds per 500 photos.

huangapple
  • 本文由 发表于 2023年4月11日 00:46:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75978955.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定