Package: blogger
bloggerbloggeris a command line utility originally created for converting articles, text, or HTML into speech. This is especially helpful for bloggers who like to provide audio options for their users.This is a wrapper around a couple of different text to speech tools and is designed to be a simple interface for any user of thebloggerCLI.bloggeris an open-source project from Buster Technologies, the creators ofBuster ERP. Our company published technical and business content on theSimpler Software Blogand needed a simple tool to convert articles to audio files.InstallingThe package is available via pypi and can be install withpiporpipenv:$pipinstall-UbloggerThe simplest examplesThebloggerCLI has default options for converting text to speech with very few inputs. Here is an example taking in a string of text and outputting the audio file:$bloggeraudio"This is an awesome article"-oarticle.mp3The defaultbasictext to speech converter gets the job done but is not the best automated speech in the world. Google has built out a much more advanced cloud API for text to speech which sounds closer to real speech. For this, you can use thegttsconverter and pass in anAPI token from Google which can be generated in the api console.$bloggeraudio\--converter=gtts\--token="$MYAPIKEY"\"This is another awesome article"\-oarticle.mp3OptionsOutside of the default configurations though, you can feedbloggersome different inputs depending on what is needed.$blogger

Usage:blogger[OPTIONS]COMMAND[ARGS]...BloggerCLI

Options:--helpShowthismessageandexit.

Commands:audioGeneratesanaudiofilefromtext,files,orurls.convertersDetailsfortexttospeechconverters.providersDetailsforcontentproviders.voicesDetailsforvoiceoptions.$bloggeraudio--help

Usage:bloggeraudio[OPTIONS][INLINE_TEXT]Generatesanaudiofilefromtext,files,orurls.AllinputisassumedtobeineitherplaintextorHTMLformat.Anyotherformatscouldhavepotentialissuesduringprocessing.

Options:--textTEXTThetexttoconverttospeech.--fileTEXTThefilepathtothefilecontainingtexttoconverttospeech.--urlTEXTParseanarticlefromaURL.-p,--providerTEXTWhenparsingfromaURL,theproviderdefinesthecontentprovider(Ex.Medium,Ghost,etc.)--url-title-selectorTEXTForthemanualprovider,thisspecifiesthetagandclassoridintheDOMthatcontainsthetitle.--url-content-selectorTEXTForthemanualprovider,thisspecifiesthetagandclassoridintheDOMthatcontainsthecontent.-t,--tokenTEXTGoogleAPItokenusedforthegttsprovider.-vi,--voiceTEXTThevoiceoption.-vp,--pitchTEXTThepitchofthevoiceonascaleof-20.0to20.0.-vr,--rateTEXTTherateofspeechonascaleof0.0to4.0.-c,--converterTEXTThetypeoftexttospeechconvertertouse.Defaultstobasic.-o,--outputTEXTTheoutputpathfortheaudiofile.Ifnotspecified,outputwillgotoSTDOUT.--full-preview/--short-previewPreviewtheentirearticlebeforeconverting.-v,--verbose/--no-verboseProvidesmoredebugginginformation.-y,--yes/--noAssumesyestoprompts.--helpShowthismessageandexit.ConvertersThere are two types of text to audio converters built intoblogger.$bloggerconverters-l

basicAsimpletexttospeechconverter.(default)gttsTheGooglecloud-basedtexttospeechconverterAPI.BasicThebasicconverter, which is used by default, converts text to speech using a simple google translate utility. As it says, it's a very basic option and outputs a decent audio file.GTTS (Google Text To Speech)Google provides acloud text to speech APIthat works much better than their previous text to speech software. You must have anAPI tokento use this converter.$bloggeraudio\--converter=gtts\--token="$MYAPIKEY"\--file=/tmp/input.txt\-oarticle.mp3If utilizing thegttsconverter, it comes with a few command line options too. The only required option is the API token:-t,--tokenTEXTGoogleAPItokenusedforthegttsprovider.
-vi,--voiceTEXTThevoiceoption.
-vp,--pitchTEXTThepitchofthevoiceonascaleof-20.0to20.0.
-vr,--rateTEXTTherateofspeechonascaleof0.0to4.0.Read the instructions onhow to generate your API token here.InputThere are multiple ways that text can be passed intoblogger. Only 1 of the following methods can be used in a single command at a time. Conflicts will result in a single input method being used and the other input being ignored.InlineAs seen in the simple example above, you can pass text directly into the CLI:$bloggeraudio"Convert this text please"-oarticle.mp3

$bloggeraudio--text="Convert this text please"-oarticle.mp3

$bloggeraudio--text="Convert this text please"--output=/my_audio/article.mp3FilesAnother option is to read a file in:$bloggeraudio--file=./article.txt-oarticle.mp3URLAnd finally you can read articles posted online, strip out the relevant content, and produce an audio file. This is ideal for articles already written and published that need to be converted afterwards.When reading a URL,bloggerneeds some help figuring out what content to be looking at. For this we use providers. A provider represents a content provider (think Medium, Ghost, Wordpress, etc.) Please see theProviderssection for more details about what blog formats are supported automatically.$bloggeraudio\--url=https://bustererp.com/blog/whats-in-python-3-8\--provider=ghost\-oarticle.mp3$bloggeraudio\--url=https://medium.com/@reedrehg/10-ways-to-prevent-technical-debt-33dd17075fba\--provider=medium\-oarticle.mp3If a relevant provider does not exist, then you can pass selectors in to show us what exactly to look for. Generallybloggeris always looking for a title and then a content body.$bloggeraudio\--url=https://myblog.com/myarticle\--url-title-selector="h1.blog-title"\--url-content-selector="div#blog-content"\-oarticle.mp3Article previewsEachaudiocommand will show you a preview of what was processed to ensure that you are pulling the right information. Use the--full-previewflag to preview the entire content, not just part of the content.$bloggeraudio--url=https://myblog.com/myarticle--provider=ghost-oarticle.mp3

Convertingaudiousingthegttsconverter:TextPreview:Loremipsumdolorsitamet,consecteturadipiscingelit.Praesentturpisante,egestasiddiamsed,convallisultriceserat.Praesentutnibhnonquampellentesquefinibus.Maecenasconvallis,metusasollicitudinporttitor,dolorleofacilisiserat,sedcondimentumnislquaminnunc.Quisquesedmattisligula,sedfinibusnunc.Proinetnislutleotempordignissiminsedmauris.Duisportalaciniasapiensitametconsequat.Quisqueegetlectusnonloremvehiculaportaeualacus.Etiamfermentum,purusatmalesuadatristique,loremelithendreritlibero,amolestiefelisfelisanibh.Quisqu...

Processing...
Successfullyoutputtedto/tmp/audio.mp3ProvidersCheck the providers list to see the currently available blog providers supported by the system. The--providerflag will only be relevant when combined with the--urloption.$bloggerproviders-l

manualUsesuserprovidedinputtodeterminehowtoparsecontent(default)ghostHandlesparsingcontentforGhosthostedblogs(https://ghost.io)mediumHandlesparsingcontentwrittenonMedium(https://medium.com)VoicesCheck the voices list to see the currently available voice. This is only compatible with thegttsconverter:$bloggervoices-l

US-AUnitedStatesenglishaccentoptionA
US-BUnitedStatesenglishaccentoptionB
US-CUnitedStatesenglishaccentoptionC
US-DUnitedStatesenglishaccentoptionD
US-EUnitedStatesenglishaccentoptionE
US-FUnitedStatesenglishaccentoptionF
AU-AAustralianenglishaccentoptionA
AU-BAustralianenglishaccentoptionB
AU-CAustralianenglishaccentoptionC
AU-DAustralianenglishaccentoptionD
GB-ABritishenglishaccentoptionA
GB-BBritishenglishaccentoptionB
GB-CBritishenglishaccentoptionC
GB-DBritishenglishaccentoptionD
IN-AIndianenglishaccentoptionA
IN-BIndianenglishaccentoptionBextremely
IN-CIndianenglishaccentoptionC$bloggeraudio\--converter=gtts\--token="$MYAPIKEY"\--file=/tmp/input.txt\--voice="US-C"\--yesContibuting tobloggerbloggeris open-source software and freely distributable under the terms of theMIT license. The source code is hosted onGitHub.Please contribute in the form of pull requests, bug reports, or general comments in theGitHub issue tracker.bloggerwas originally created byHolden Rehg, with development sponsored byBuster Technologies.Buster Technologies, LLC.