In case anyone is interested, I made a Google Apps Script that will copy all AO3 story links in your Gmail inbox and then print it out so that you can just copy all of that and immediately add it to FanficFare.
How I use this:
- For me, all AO3 story updates or new stories from followed authors are immediately set to be in the Updates category by Gmail.
- I have Gmail set to automatically match all emails from @archiveofourown.org and apply the label "Fanfic" to those emails.
- Whenever I have a few emails of new story updates or new stories from authors I follow, I leave them in the inbox under the Updates category *and* the Fanfic label.
- I then run this script from script.google.com and then copy the contents of the last Log printout, then paste it in Fanficfare's "Download from URLs" tab.
- All the story links will then be immediately downloaded by Fanficfare.
- I then archive all of those emails so they are no longer in my inbox and won't be gathered again the next time I run the script.
Why I do this:
- Previously I had to manually look at each email and then right click on the story name, click on "Copy Link" and then paste it into Fanficfare. It was troublesome to do so especially if there are multiple fics that have been updated since the last time I saved all of them.
- Now I can just ensure that all the AO3 emails that are in my inbox and are labelled with "Fanfic" are the stories that I want to download, then run the script to copy all the emails' story links into one easy place to copy into Fanficfare, instead of copying the links one by one, email by email.
How to set this up:
1. Go to
https://script.google.com/ and create a new project.
2. Replace whatever code is in there by default with the following. Change the label or category as needed.
Code:
function collectLinks() {
// Get the label to search
var label = "Fanfic";
// Get the category to search
var category = "Updates";
// Get the regex expression for the email subject
var subjectRegex = /[AO3]/;
// Get the regex expression for the link
var linkRegex0 = /http:\/\/archiveofourown.org\/works\/(\d+)/;
var linkRegex = new RegExp(linkRegex0, "g");
var links = new Set(); // So that only unique links will be stored (n)
// Get all messages in the label and category that are in the inbox (ie. not deleted or archived)
var threads = GmailApp.search('label:' + label + ' category:' + category + " in:inbox");
// Iterate over the threads
for (var i = 0; i < threads.length; i++) {
// Get all messages in the thread
var messages = threads[i].getMessages();
// Iterate over the messages
for (var j = 0; j < messages.length; j++) {
// Get the subject of the message
var subject = messages[j].getSubject();
Logger.log("Subject: "+ subject);
// If the subject matches the regex expression
if (subjectRegex.test(subject)) {
var body = messages[j].getBody();
// Get the link from the message
var extractedLinks = body.match(linkRegex);
// var extractedLinks = body.matchAll(linkRegex);
// Print the link
Logger.log("Extracted link: "+ extractedLinks);
// Add the extracted links into the set of links
for (var link of extractedLinks) {
links.add(link);
}
}
}
}
// Log out all collected links
var uniqueLinks = Array.from(links);
Logger.log(uniqueLinks);
}
3. Click on Run
4. Copy the contents of the last Log Info line, excluding the open and close square brackets.
5. Go to Fanficfare in Calibre and click on the down arrow, then click on "Download from URLs".
6. The contents of whatever was copied should be automatically pasted inside.
7. Change the download options if needed, then click on OK.
If there are any better ways to do this, I'm also open to hearing about it!