abdullahtarawneh.com/content/blog/photobucketgrabber/index.md

39 lines
2 KiB
Markdown

+++
title = "PhotoBucketGrabber"
summary = "[OBSOLETE] Download all your photos from PhotoBucket using this Python script."
authors = ["a"]
date = 2019-03-17
tags = ["python", "photobucket", "automation", "scripting", "archive", "export", "download"]
categories = ["Code"]
aliases = [
"/code/photobucketgrabber",
]
+++
<aside style="background: #ffcccc; padding: 1em; border-left: 4px solid red;">
<p style="font-weight: bold; display: flex; align-items: center; gap: 0.5em;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5" width=20 height=20>
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z" clip-rule="evenodd" />
</svg>
This is no longer needed.</p>
<p>Photobucket now provides this functionality natively.</p>
</aside>
## The problem
I had an old PhotoBucket account that I wanted to archive and delete. However, it would take an extremely long time to manually save each photo and recreate any albums' folder structure.
## The research
PhotoBucket allows copying direct image links, and it also allows copying multiple links at the same time. This is used to obtain a list of all photo direct URLs, which can be saved in a text file and read by a script.
Additionally, direct URLs maintain the folder and file names, so the path structure can be saved directly using Python's Path library.
## The solution
See my source code here: https://github.com/trwnh/PhotoBucketGrabber
Limitations:
- The prefix to be stripped is hardcoded, because it will always be the same for an account.
- There is no way to programmatically obtain a list of all photos or albums from Photobucket, as far as I know, so the selection step is still manual. I think for a one-time task, this is probably not an issue, as it would take more time to attempt to code a solution than it would to simply select all photos from the web dashboard.