feedmixer开源项目

我要开发同款
匿名用户2021年12月23日
219阅读

技术信息

开源地址
https://github.com/vscode-neovim/vscode-neovim
授权协议
WTFPL License

作品详情

FeedMixer

FeedMixerisalittlewebservice(Pytho3/WSGI)whichtakesalistoffeedURLsadcombiesthemitoasigle(Atom,RSS,orJSON)feed.Usefulforpersoalewsaggregators,"plaet"-likewebsites,etc.

StatusChagelogv2.3.1Morecosistetbuilds:updatedepedeciesiPipfile.lock(whichalsoseemstoworkbetterwithewerversiosofpipev)adpiDockerfilebaseimagetospecifichashv2.3.0Replaceo-diskcachewithi-memorycache.Thissimplifiesapplicatiocodeadadmiistratio(do'thavetoworryaboutpruigthecachedatabase)v2.2.0FixhadligofRSSfeedswithmissigpubDatessothattheysorttothebottomisteadofthrowigaexceptiodurigsortigv2.1.0FixhadligofRSSeclosuresadAtomlikssothattheyareicludedioutput(importatifyou'retryigtoaggregatepodcastsorsimilar)v2.0.0TheJSONoutputowcoformstoJSONFeedversio1.Thisbreaksayclietwhichdepedsothepreviousad-hocJSONformat.Thatlegacyformatwillcotiuetobemaitaiedithev1brach,soayclietswhichdo'twattoupdatetotheJSONFeedformatshoulddepedothatbrach.v1.0.0StableAPI.I'musigitiproductioforsmallpersoal"plaet"-likefeedaggregators.API

FeedMixerexposesthreeedpoits:

/atom/rss/jso

WhesetaGETrequesttheyreturaAtom,aRSS2.0,oraJSONfeed,respectively.ThequerystrigoftheGETrequestcacotaithesefields:

fAurl-ecodedURLofafeed(ayversioofAtomorRSS).Toicludemultiplefeeds,simplyicludemultipleffields.Theumberofetriestokeepfromeachfield(pass0tokeepalletries,whichisthedefaultifofieldisprovided).fullIfsettoaythig,preferthefulletrycotet;ifabset,prefertheshorteretrysummary.FeaturesAPICombieseveralfeeds(justaboutayversioofAtomadRSSshouldwork)itoasiglefeedOptioallyreturolythemostrecetitemsfromeachiputfeedCotrolwhethertheoutputfeedcotaisolythesummaryortheetirecotetoftheiputfeeditemsParserresultsarememoizedsothatrepeatedrequestsforthesamefeedcabereturedwithoutre-parsig.IcludedWSGIapp

Theprovidedfeedmixer_wsgi.pyapplicatiousesasessiothatcachesHTTPresposessothatrepeatedlyfetchigthesamesetsoffeedscausuallyberespodedtoquicklybytheFeedMixerservice.

TheFeedMixerobjectcabepassedacustomrequests.sessioobjectusedtomakeHTTPrequests,whichallowsflexiblecustomizatioihowrequestsaremadeifyoueedthat.

No-features

FeedMixerdoesot(yet?)doayresourcerestrictioitself:

AuthorizatioRatelimitigCORSrestrictio

TOprotectyouristallatioeithercofigureafrot-edhttpproxytotakecareofyourrequiredrestrictios(Ngixisagoodchoice),or/adusesuitableWSGImiddleware.

IstallatioCloethisrepository:$gitcloehttps://github.com/cristoper/feedmixer.git$cdfeedmixerRecommeded:usepipevtocreateavirtualevadistalldepedecies:$pipev--threesyc

Theprojectcosistsofthreemodules:

feedmixer.py-cotaisthecorelogicfeedmixer_api.py-cotaistheFalco-basedAPI.Callwsgi_app()togetaWSGI-compliatobjecttohost.feedmixer_wsgi.py-cotaisaactualWSGIapplicatiowhichcabeusedas-isorasastartigpoittocreateyourowcustomFeedMixerservice.RuLocally

Thefeedmixer_wsgimoduleistatiatesthefeedmixerWSGIobject(withsesibledefaultsadarotatiglogfile)asbothapiadapplicatio(defaultamesusedbycommoWSGIservers).Tostarttheservicewithguicor,forexample,cloetherepositoryaditherootdirectoryru:

$pipevrupip3istallguicor$pipevruguicorfeedmixer_wsgi

Notethatthetop-levelistalldirectorymustbewritablebytheserverruigtheapp,becauseitcreatesthelogfiles('fm.log'ad'fm.log.1')there.

Asaexample,assumigaistaceoftheFeedMixerappisruigothelocalhostoport8000,let'sfetchtheewestetryeachfromthefollowigAtomadRSSfeeds:

https://catswhisker.xyz/shaarli/?do=atomhttps://hrss.org/ewest

ThecostructedURLtoGETis:

https://localhost:8000/atom?f=https://catswhisker.xyz/shaarli/?do=atom&f=https://hrss.org/ewest&=1

EterigititoabrowserwillreturaAtomfeedwithtwoetries.ToGETitfromaclietprogramatically,remembertoURL-ecodetheffields:

$curl'localhost:8000/atom?f=https%3A%2F%2Fcatswhisker.xyz%2Fshaarli%2F%3Fdo%3Datom&f=https%3A%2F%2Fhrss.org%2Fewest&=1'

HTTPieisaicecommad-liehttpclietthatmakestestigRESTfulservicesmorepleasat:

$pip3istallhttpie$httplocalhost:8000/jsof==https://hrss.org/ewestf==https://catswhisker.xyz/atom.xml==1

YoushouldseesomeJSONFeedoutput(sicewearerequestigfromthe/jsoedpoit):

HTTP/1.1200OKCoectio:closeDate:Thu,23Ja202003:53:45GMTServer:guicor/20.0.4cotet-legth:1296cotet-type:applicatio/jso{"versio":"https://jsofeed.org/versio/1","title":"FeedMixerfeed","home_page_url":"https://localhost:8000/jso?f=http%3A%2F%2Fhrss.org%2Fewest&f=https%3A%2F%2Fcatswhisker.xyz%2Fatom.xml&=1","descriptio":"jsofeedcreatedbyFeedMixer.","items":[{"title":"KyrsteSiema,theOlyAti-NetNeutralityDem,LikedtoComcastSuperPac","cotet_html":"<p>ArticleURL:<ahref=\"https://prospect.org/politics/kyrste-siema-ati-et-eutrality-super-pac-comcast-lobbyist/\">https://prospect.org/politics/kyrste-siema-ati-et-eutrality-super-pac-comcast-lobbyist/</a></p>\<p>CommetsURL:<ahref=\"https://ews.ycombiator.com/item?id=22124592\">https://ews.ycombiator.com/item?id=22124592</a></p>\<p>Poits:1</p>\<p>#Commets:0</p>","url":"https://prospect.org/politics/kyrste-siema-ati-et-eutrality-super-pac-comcast-lobbyist/","id":"https://ews.ycombiator.com/item?id=22124592","author":{"ame":"joeyespo"},"date_published":"2020-01-23T03:32:19Z","date_modified":"2020-01-23T03:32:19Z"},{"title":"FORoudupDecember2019","cotet_html":"I'vestartedkittigagai.","url":"https://catswhisker.xyz/log/2019/12/3/fo_december/","id":"tag:catswhisker.xyz,2019-12-04:/log/2019/12/3/fo_december/","author":{"ame":"A.Cyic","url":"https://catswhisker.xyz/about/"},"date_published":"2019-12-04T04:48:59Z","date_modified":"2019-12-04T04:48:59Z"}]}Deploy

DeployFeedMixerusigayWSGI-compliatserver(uswgi,guicor,mod_wsgi,...).Foraproductiodeploymet,putaasychrooushttpproxy(likeNgix)ifrotofFeedMixertoprotectitfromtoomayadslowcoectios(aswellastoprovideSSLtermiatio,additioalcachig,authoriziatio,etc.,asrequired)

Refertothedocumetatiooftheserverofyourchoice.

Apache

ForotesodeployigbehidApache,seeapache.rst(fromhtmldocs:apache.html)

Docker

AalterativetousigavirtualevforbothbuildigaddeployigistoruFeedMixeriaDockercotaier.TheicludedDockerfilewillproduceaimagewhichrusFeedMixerusigguicor.

Buildtheimagefromthefeedmixerdirectory:

$dockerbuild.-tfeedmixer

Ruititheforegroud:

$dockerru-p8000:8000feedmixer

NowfromaothertermialyoushouldbeabletocoecttoFeedMixerolocalhostport8000justasitheexampleabove.

Troubleshootig

Usigtheprovidedfeedmixer_wsgi.pyapplicatio,iformatioaderrorsareloggedtothefilefm.logithedirectorytheapplicatioisstartedfrom(autorotatedwithasigleoldlogcalledfm.1.log).

AyerrorsecouteredifetchigadparsigremotefeedsarereportediacustomHTTPheadercalledX-fm-errors.

Hackig

Firstistallasperistructiosabove.

Documetatio

OtherthathisREADME,thedocumetatioisithedocstrigs.Tobuildaprettyversio(HTML)usigSphix:

IstallSphixdepedecies:$pipevrupipistall-rdoc/requiremets.txtChagetodoc/directory:$cddocBuild:$pipevrumakehtmlView:$x-www-browser_build/html/idex.htmlTests

TestsareithetestdirectoryadPythowillfidadruthemwith:

$pipevrupytho3-muittestTypecheckig

Tochecktypesusigmypy:

$MYPYPATH=stub/mypy--igore-missig-imports-pfeedmixer

Noteverythigisstubbedout,butcabeusefulforcatchigbugsafterchagigfeedparser.py

Gethelp

FeelfreetoopeaissueoGithubforhelp:https://github.com/cristoper/feedmixer/issues

Supporttheproject

Ifthispackagewasusefultoyou,pleasecosidersupportigmyworkothisadotherope-sourceprojectsbymakigasmall(likeatip)oe-timedoatio:doateviaPayPal

Ifyou'relookigtocotractaPythodeveloper,Imightbeabletohelp.Cotactmeatchris.burkhardt@orageoiseproductio.com

Licese

TheprojectislicesedudertheWTFPLlicese,withoutwarratyofaykid.

功能介绍

FeedMixer FeedMixer is a little web service (Python3/WSGI) which takes a list of feed URLs and co...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论