You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is how I did it. Just create the local_storage directory first.
#!/usr/bin/env python3fromgphotospyimportauthorizefromgphotospy.mediaimportMedia, MediaItemfrompathlibimportPathimporturllib.error# Select secrets file (got through Google's API console)CLIENT_SECRET_FILE="credentials.json"# Here your secret's file. See below.# Get authorization and return a service objectservice=authorize.init(CLIENT_SECRET_FILE)
local_storage=Path("local_storage")
media_manager=Media(service)
foriinmedia_manager.list():
i=MediaItem(i)
print(i.filename())
local_file=local_storage/i.filename()
ifnotlocal_file.exists():
try:
content=i.raw_download()
excepturllib.error.HTTPError:
print(f"Cannot download: {i.filename()}")
continuelocal_file.write_bytes(content)
Hello! Thanks for gphotospy.
Please add example for download all album and all photo from google photo to local.
Thanks!
The text was updated successfully, but these errors were encountered: