php-mastodon-rss-to-bot-stateless开源项目

我要开发同款
匿名用户2021年11月08日
116阅读

技术信息

开源地址
https://github.com/esl/elarm
授权协议
MIT License

作品详情

PHPFeed-to-BotToolforMastodo

AtoolforcreatigbotsforMastodowhichreadRSS/Atomfeeds.

Features:

MultiplebotsfromoescriptMultiplefeedsperbotSupports(valid)RSSadAtomStateless:ithesesethatitdoesotmaitaiacacheofwhichRSSpostshavebeecovertedtotoots.

CurretlyruigtheRFIBotomastodo.social

Setup

RequiresPHP7.0

YouwilleedacertfiletoruGuzzle.

Youwillalsoeedtosetthetimezoeofyourcomputerviathephp.iidate.timezoesettig.

LoadDepedecies

DepedeciesareloadedviaComposer

composeristall

Itusesthefollowigdepedecies:

phediverse/mastodo-restdg/rss-phpguzzlehttp/guzzleApplicatio

Thiscodetakescareofruigthe3rdpartyapplicatiowhichhadlesthebots.

Youwilleedtocopy/cofiguratios/APP.example.jsoto/cofiguratios/APP.jso.

I/cofiguratios/APP.jsochagetheamepropertytoacustomame.

BotCofiguratio

YouwillfirsteedtomauallymaketheaccoutotheMastodoistaceofyourchoicewithaemail,passwordaduserame.

Thefile/cofiguratios/example.jsoisaexampleofabotcofiguratio.CreateaewJSONithe/cofiguratios/folderadameitforyourbot.

{"istace":"social.targarye.house",//like'mastodo.social'"userame":"my_userame",//userameforyourbot'saccout,otdisplayame//otusedatthispoit"email":"myemail+botame@mail.com",//emailforyourbot'slogi"password":"realpassword",//passwordforyourbot'slogi"hashtags":["all"],//arrayofstrigsthatyouwatas//hashtags(#)ieachtoot//dootadd'#'"feeds":[{//arrayoffeedsforthisbot"type":"rss",//typeoffeed,rssoratom"url":"https://www.website.com/rss/oe.xml",//urltofeed"hashtags":["cats"]//hashtagsforeverytootfromthisfeed},{"type":"rss","url":"https://www.website.com/rss/two.xml","hashtags":["music"]},{"type":"atom","url":"https://www.website.com/atom/three.xml","hashtags":["mood"]}]}

Createaseparatecofiguratiofileforeachbotyouwishtoru.

UseUpdates

Ifyourcofiguratiofileiscalledmy_rss.jso,thetheRSSitemscabeposted/updatedwith:

php/path/to/php-mastodo-rss-to-bot-stateless/idex.phpmy_rss

Pleaseotethelackof'.jso'itheparameter.

Tokeeptheapplicatio'stateless'(seetop),thetoolworksbasedoffoftimestamps.ThetoolwillcheckthetimestampofthelatesttootadgetallFeeditemsafterthattimestampadpoststhem.

Obviously,thishasthepotetialtootbeasaccurateasabotwithacache,butI'mtoolazytobuildoe.Ifyourfeedhasitemsaddedeverymiute(hopefullyulikely),thethistoolmaymissaitemortwoalogtheway.

Ifthebotisewadhasoposts,itwillolypostthemostrecetfeeditem,ottheetirefeed.

Schedulig

Iordertohaveabotthatupdatesregularly,youwilleedtoscheduletheabovePHPcallwithaCrotaskoraScheduledTaskdepedigoyoursystem.

Youwilleedtoscheduleseparatetasksforeachbot/cofig.

Additioal

Ifyoueedtodisablethetoolforawhile(systemmaiteace,etc),butyoudo'twatthebottofloodMastodowithabuchofbelatedpostswheitstartsupagai,youcajustmakeapostdirectlytothebotviatheMastodoiterfaceadthestartthescheduledtaskagai.TheewpostwillmakesurethemostrecettimestampitheToottimelieisuptodate.

TODOCreatecofigclasstovalidatecofiguratiosAddutilityclassadPHPUitforlogtermstabilityGettootlegthbyistaceReplacestrlewithmorereliablefuctioExtedtoayiterable,fetchable,timestampedresource

功能介绍

PHP Feed-to-Bot Tool for Mastodon A tool for creating bots for Mastodon which read RSS/Atom feeds...

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

评论