Batch Changing Facebook Album Descriptions
Interlinking multipart albums.
I am doing an internship at Nara Institute of Science and Technology for 2 months. During my time here, I traveled a lot and took many photos, and uploaded them to Facebook.
The problem is that when there are so many photos in a single album, performance degrades (and kind of make it hard to manage the photos).
So I split my album into many parts (one for each week).
The problem: Make these albums interlinked by putting links in the description of each album linking to other albums.
I decided to do browser automation, so I used watir-webdriver.
It lets you control any web browser supported by Selenium WebDriver, including Firefox and Chrome.
Logging in to Facebook
I then logged in to Facebook inside that profile, so I don’t have to write code to automate the login process.
To make the script reusable, I make it read from a text file. Here is an overview of the process.
- The text file containing the description is read.
- Album URLs are scanned.
- For each album, its description is updated according to the text file.
This script, album_description.rb, reads the text file and updates the album descriptions accordingly.
The code is reproduced here:
Make sure you installed the watir-webdriver gem. Then create a text file and put the description inside.
Include the URL of each album inside the text file, since it is used by the script to scan for albums to update. For example:
This is the description of the album.
This album contains many parts.
Part 1: https://www.facebook.com/dtinth/media_set...
Part 2: https://www.facebook.com/dtinth/media_set...
Part 3: https://www.facebook.com/dtinth/media_set...
Then run the script:
ruby album_description.rb path/to/file.txt
You should see something like this:
== Album Description Updater ==
There are 2 albums whose descriptions are to be updated!
- Updating: NAIST Internship [Week 0]
- Updating: NAIST Internship [Week 1]
Now you can customize the script to your will, such as:
- including the album number in the description (e.g. this is album 1 of 3).
- setting a different description for each album.