Comment

Comment by busymom0

Not sure about OP but I just implemented this in my Hacker News android client (thanks for the idea OP).

This is how I implemented it. I had already achieved article to "reader mode" extraction by heavily customizing the Kotlin port of Mozilla‘s Readability:

https://github.com/dankito/Readability4J

From the extracted "reader mode" text, I had to do further extraction to get rid of things like image captions, author names, article publish timestamps etc. Also links had to be removed to not let the TTS engine speaking out links.

Then I pass the text via Android's TextToSpeech library and it works very well:

    fun trySpeaking(str:String){
    
        fun speak(){
            tts?.speak(str, TextToSpeech.QUEUE_FLUSH, null, null)
        }
    
        tts?.also {
            it.stop()
            speak()
        } ?: run {
            tts = TextToSpeech(appContext) { status ->
                println("Speak: $status")
                if (status == TextToSpeech.SUCCESS) {
                    speak()
                }
            }.apply {
                language = Locale.US
            }
        }
    }
If someone wants to do a tl;dr on the article text, they could pass it through SMMRY api (which the Reddit's TL;DR bot uses):

https://smmry.com

On Desktop, one can do text to speech conversion using mozilla TTS:

https://github.com/mozilla/TTS

Or Amazon Polly:

https://aws.amazon.com/polly/

For anyone wanting to give it a try, this "article to audio" will be available in tomorrow's update in my app. The reader mode is already available:

https://play.google.com/store/apps/details?id=com.pranapps.h...

Full disclaimer: I am the developer of the app and the Android version is brand new (released at 4am this morning).

parent busymom0 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton