Add support for Firefox "reader view" (or alternative)
I use Firefox (latest from Google Play) on Android (14), with the latest Read Aloud extension, and when I open a web page and press the "reader view" button (i.e. the view that removes all the site cruft, and is focused on reading the actual article content), and then I try to use the Read Aloud extension, it yields a Cannot read this website error. (The same article, without the "reader view" feature engaged, is read OK by the extension.)
Why might this error happen?
If the feature is implemented on mobile Firefox as is on the desktop Firefox, then the URL of the document when in "reader view" is changed to about:reader?url={url-component-encoded}, and perhaps the plugin isn't allowed access to these pages.
Why is this feature important?
I think that the extension already uses some heuristics to detect the article content, however they don't work as good as the Firefox "reader view" algorithm, and more often than not, the Read Aloud extension reads comments, page meta-data, and other fluff.
An alternative would be embed the Firefox "reader view" algorithm (available open-source and extracted from Firefox at https://github.com/mozilla/readability, maintained by Mozilla), and allow the user to choose which content extraction algorithm to use. (The original one, or the Firefox one.)
All 'about:' pages are special pages that extensions aren't allowed to access, i.e. inject code to grab the text content. So you'll have to start Read Aloud before entering reader mode.
We can add an advanced option to use the Readability library. If a page isn't 'readerable', fall back to our own algorithm.
So you'll have to start Read Aloud before entering reader mode.
The main problem I was facing, and the reason I wanted to resort to Readability, is that the current default Read Aloud algorithm doesn't work on some pages and include more blurb text than the Readability one.
Indeed, if about: pages are not targetable (I didn't know this restriction for extensions, and when I've used userChrome.css it worked, but that perhaps bypasses this restriction), then embedding the Readability algorithm might be a choice.
On the topic of embedding Readability: I've been playing with it a bit in the weekend, and so far Mozilla has released (at least tagged in their repository) a few versions, 0.6 (the latest), 0.5, and 0.4. I think 0.6 has a few bugs on certain sites, and doesn't always work, thus for my experiments I've resorted to a waterfall model of trying 0.6, then 0.5, etc.
Perhaps if embedding Readability is the course to take, then embedding at least two Readability versions might be a good choice, allowing the user to choose between old / new versions if for a certain site one of the versions doesn't work.