Commandlinetooltoextractthemaincontentfromawebpage,asdonebythe"ReaderView"featureofmostmodernbrowsers.It'sintendedtobeusedwithterminalRSSreaders,tomakethearticlesmorereadableonwebbrowserssuchaslynx.ThecodeiscloselyadaptedfromtheFirefoxversionandtheoutputisexpectedtobemostlyequivalent.
SecurityThistoolisyoungandwritteninC,soit'sreasonabletowonderaboutthepotentialformemoryissues.Tobesafe,allHTMLparsinghappensinsideasandboxedsubprocess.SeccompisusedforthispurposeonLinux,PledgeonOpenBSD,andCapsicumonFreeBSD.
UsageLinuxTherearethreedirectdependencies:libxml2,libseccompandlibcurl.OnDebian/Ubuntu,youcaninstallthefirsttwobyrunning(asroot):
aptinstalllibxml2-devlibseccomp-devThelibcurlpackagecomesindifferentflavours,dependingonthebackendthatprovidestheSSLsupport.Anyofthemwilldo.ToinstalltheGnuTLSversion:
aptinstalllibcurl4-gnutls-devForrdrviewtobeuseful,youshouldalsogetacharactermodewebbrowsersuchaslynx:
aptinstalllynxThenameofthepackagesmightdifferinyourdistribution.OnFedora,forexample,youcaninstalleverythingwith:
dnfinstalllibcurl-devellibxml2-devellibseccomp-devellynxTobuildrdrview,justcdtoitsdirectoryandrun
makeNowitshouldbereadytobeused.Youcantry:
./rdrview'https://github.com/eafer/rdrview'Formoreinformation,seethemanpage:
man./rdrview.1Ifyoufindrdrviewusefulandwanttoinstallit,becomerootagainandrun
makeinstallNowyoucanjustcallitwithrdrviewandgethelpwithmanrdrview,likeyouwouldforanyothertoolinyoursystem.
BSDsTobuildrdrviewontheBSDs,youwillneedGNUmakeaswellasthelibraries.Havingaterminalbrowseravailableisrecommended.OnOpenBSD,becomerootandrun
pkg_addgmakecurllibxmllynxOnFreeBSD,thatwouldbe
pkginstallgmakegcclibxml2curllynxNowyoucancdtothesourcedirectoryandrungmakeforthebuild,andoptionallygmakeinstallfortheinstallation.TheBSDsdon'tprovideanymailcapfilebydefault,sotorunrdrviewyouwillneedtospecifythewebbrowser:
./rdrview-Blynx'https://github.com/eafer/rdrview'macOSIdon'townanyApplecomputerstotestthismyself,butI'vebeentoldthatrdrviewdoesbuildonmacOS.Asandboxisnotyetimplemented,butthetoolcanstillberunwiththe--disable-sandboxflag,aslongastheuserunderstandstherisk.
CreditsrdrviewwaswrittenbyErnestoA.Fernández,butit'smainlyatranspilationdonebyhandofMozilla'sReadability.js;whichwasitself,intheirownwords,"heavilybasedonArc90'sreadability.js".Thisistheoriginallicense:
Copyright(c)2010Arc90IncLicensedundertheApacheLicense,Version2.0(the"License");youmaynotusethisfileexceptincompliancewiththeLicense.YoumayobtainacopyoftheLicenseathttps://www.apache.org/licenses/LICENSE-2.0Unlessrequiredbyapplicablelaworagreedtoinwriting,softwaredistributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.SeetheLicenseforthespecificlanguagegoverningpermissionsandlimitationsundertheLicense.
评论