Now, to the topic of this post: making an Audible series notification system. Audible.com is an Amazon-owned service for audio books, and realistically the only real option out there for audio books in my opinion. While I love the books it sells me, the service itself is absolutely horrible from a technical point of view. Everything about its back end and its apps is outdated, to the point where most of what I complained about in a post six years ago is still the case. One of the most annoying issues to me personally is that even though so many audio books are part of a series, Audible offers no way to properly keep up with them. Some years back they added a series listing to each series, but there’s no subscription or notification system in place to let you know when new books come out.
I’ve had a solution in place for this for a while now, and shared it on Reddit a year ago (won’t link as that version no longer works). While I had to rewrite parts of it after a change that Audible made to their page layout, the underlying data processing in the Tasker task has gone unchanged — until today. As part of my mission to start using JSON more in Tasker, I decided it was time to rewrite the whole task to use JSON and then post about it.
The basic concept
The way this works is that it uses Audible’s series listings — specifically their mobile pages — to grab book lists. The mobile site is used because it’s simpler, allowing AutoTools’ HTML Read feature to read it easily. The URL format of the mobile series listing is as follows:
The asin query string is a unique ID of the book series, in this case the excellent Castle Federation series by Glynn Stewart. The series ID can be found in the URL of any series listing (not just for mobile), which is linked to from book pages and your library.
Thanks to the AutoTools plugin, it’s easy to take the series listing page and turn it into Tasker variables and arrays, which can then be processed and used as the basis for creating notifications. The rewritten version of my task for doing this uses JSON as a backend for storing series names, IDs, and processed books, taking a list of series IDs and checking each series listing page for new books.
Note that currently, it doesn’t distinguish between different types of listings. A book may be on the list because it’s available to purchase, available for pre-order, or simply listed as “not available on Audible”. I may make it more intelligent in the future, but it hasn’t been a necessity for me in the year I’ve used the first version of this.
How everything is set up in Tasker
I have two tasks that are part of this system in Tasker. The first one is a task that is designed to let me add new series easily. Aside from Tasker, you need AutoTools for this to work.
You can download the task here. The first time you run it, you may want to disable action 5, as there’s no JSON file to import the first time. Subsequent runs (with new IDs every time) should have it enabled as it will add data to the existing file. Add only one series at a time (i.e. no comma separated IDs), or rewrite the task with a For loop if you’re so inclined.
To add a new series, simply edit action 1, replacing the ID there with that of your new series. The default is a series everyone should check out, Starship’s Mage. Then you just need to run it, and it will find the name of the series and save that and the ID to an audible.json file in your Tasker folder.
The main task can be downloaded here. It is what actually performs the check for new books, which means you need to trigger it somehow — manually, with a time context, as part of another profile — whatever you want.
The first action imports the JSON file that the other task has created. You’ll get three arrays: %seriesid(), %seriestitle(), and %seriesbooks(). The last one will be empty the first time, but that’s ok.
Action 2 initiates a For loop for each array index number in the %seriesid() array, i.e. it loops for as many times as you have series set up. The loop first clears a local array it uses (as it persists through loops), then action 4 uses HTML Read to grab the book list from Audible based on the series ID. This results in the array %books(). Action 5 removes the first entry, which is a false positive caused by the series’ summary.
Then we get to the nested For loop that processed the book list. The short explanation is that for every book on the list, it checks to see if it has already been processed, and if not, creates a notification and then adds it to the list of processed books.
The notification, action 10, can be changed or customized — my personal version of this has an “open” button that used Join to open the series page on my computer.
The longer explanation has to do with how it does this. When there are processed books listed in the JSON, these will be as a single value that uses € as a separator between book titles, rather than being stored as a proper JSON array. That way, the indices will match; %seriesid1, %seriesid1, and %seriesbooks1 will reference the same series. Action 8 takes the processed books list for that series and turns it into a local array whose name is a lowercase converted (to avoid having it be a global variable) version of the series ID. The If group in action 9 checks to see if the book title is among the already processed ones, and only runs actions 10–13 if it’s not. Actions 11–13 updates the list of processed books, turning it back into a single variable to have the array indices match the other two arrays.
Actions 17–19 joins the arrays using another unique joiner, ¥. This prevents any series titles or book titles with commas in their names from messing up anything. JSON Write can be configured to use this custom separator, so the resulting JSON will look normal (aside from the processed books lists, whose € separator will show up as “\u20ac” in the JSON if you don’t look at it through a viewer that parses the unicode.
Once actions 20–21 have updated the JSON file, it’s ready to use the updated info on the next run. The first task, which adds new series, can be used independently as it will add to the JSON, not replace it.
Some final words
I just rewrote the task to use JSON today, so there may be issues I haven’t accounted for. The basics are the same as the task I’ve used for a year, however, so it should be fine unless Audible changes how their mobile series page looks.
It baffles me that this functionality is something that has to be hacked onto Audible. They’re a huge company, owned by a gigantic one, and this is such a basic feature to have when you’re selling anything that’s serialized. Then again, listing everything about Audible that seems unbelievable dumb would take a while. A much better use of everyone’s time is to simply set this up and enjoy the books they have on offer.
Make sure to follow and comment what you though about this creation, or about using Medium for posts like this. Like I said I’m just testing the platform, and will see how it works for these types of posts.