How to Make a Twitter Bot in 1 Hour or Less€¦ · Bots are data driven Bots today operate on much...

Preview:

Citation preview

HowtoMakeaTwitterBotin1HourorLess

Élika OrtegaCultures,SocietiesandGlobalStudies

NULabe.ortegaguzman@northeastern.edu

@elikaortega

WhatisaTwitterBot?

• AutomatedTwitteraccount,• Spam,• Propaganda,• SoftwareapplicationthatpostscontenttoTwitter,automaticallyeitheronascheduleorrespondingtospecificconditions,• GenreofElectronicLiterature

Potential

"everyfigureofspeech...andpracticallyeverylinguisticstructure...everyworkofliterature,everywriter’sbodyofwork,everyliterarymovement,nationalliterature...everydatastream...Socialinteractions,conversations,callsandresponses,platform-defined interactions(retweets,favorites,andsoon)areallreadytobecodifiedintoalgorithmsandexploredviabot."

(LeonardoFlores"I❤Bots")

Botsareprocedural

Abot’scontentisautomaticallygeneratedwithouthumanintervention,usingasetofpredeterminedrulesandprocedures.

AllisonParrish“Bots:ADefinitionandSomeHistoricalThreads.”

Botsareuncreative(unoriginal)

Writingthatconcernsitselfwithcategorizing,remixing,andre-enactingpre-existingtextualartifacts.Uncreativewritingisproducednotthrough“inspiration,”butbyapproachinganexistingtextandre-readingit,drawingoutsomethingnewandunexpectedintheprocess.

AllisonParrish“Bots:ADefinitionandSomeHistoricalThreads.”

Botsaredatadriven

Botstodayoperateonmuchmoredataandusemuchmoresophisticatedstatisticaltechniquesthanwereavailableto20th-centurywritersthatusedproceduraltechniques.

Contemporarybotmakers regularlymakeuseoflargecorpora,andinparticularthecorpusofTwitteritself.

AllisonParrish“Bots:ADefinitionandSomeHistoricalThreads.”

Botsaregraffiti

Thecharacteristicofbotsthatdistinguishesthemmostreadilyfromotherkindsofpoetryandartisthattheyareinterventionsinapublicspace.

AllisonParrish“Bots:ADefinitionandSomeHistoricalThreads.”

TullyHansen's"TaxonomyofTwitterBots"

WhyTwitterbots?

• Trolls• Tooshorttosayanythingmeaningful• Deformationoflanguage• Currentpoliticalclimate

Authorialresponsibility

@HaikuD2byJohnBurger

@pentametron byRanjitBhatnagar

@TwoHeadlines yDariusKazemi

@infinitedesserts by@getdizzzy

@tiny_star_fields bykatierose

@StudiesBot byMarkSample

@ClearCongress byZachWhalen

@everyword byA.Parrish

@NRA_Tally byMarkSample

@DroptheIbot byPatrickHogan andJorgeRivas

Dotheymakesense?

• Partofthepointofbotsistomakesense(notjustlinguisticsense)outofwhattheygenerate• Remediatedynamicsofcut-up andexperimentalart• Resistancemightcomefromimpersonating– Twitterbotsunlikemostotherartworksco-existwithusinapublicspace

Let’smakeabot!Inlessthanonehour…

Abot“lives”onaserverbut“works”onTwitter

Ourtools:

• Tracery-- http://www.brightspiral.com/tracery• Texteditor• Corporahttps://github.com/dariusk/corpora/tree/master/data• CheapBotsDoneQuick– http://cheapbotsdonequick.com• Twitteraccountdedicatedtobot

Firstwebuildthebot

Thewemakeittweet

1.Traceryhttp://www.brightspiral.com/tracery/

• InterfacethatcreatesandstructurestheJSONfile• Traceryhasembeddedthegenerativeenginethatrecombinesthevalues includedineach“symbol”

1.Traceryhttp://www.brightspiral.com/tracery/

• “origin”isreservedforthebot’sstructure• #___#indicatesrandomizedcontentfromsymbols• Therestisconstant,includingspaces

JSONfile(JavaScriptObjectNotation)

• human-readabletext• dataobjectsconsistingofattribute–valuepairs• highlystructured(commas,quotationmarks,brackets)

JSONfile(JavaScriptObjectNotation)

• human-readabletext• dataobjectsconsistingofattribute–valuepairs• highlystructured(commas,quotationmarks,brackets)

Thesamecontent

Differentcombinations

Experimentaddingwordsandbuildingmorecomplexsentences

Traceryisnotaworkspace,onceyouhaveaworkingidea,copythe.json outputandcontinueinyourtexteditor

Usethecorporaavailablehttps://github.com/dariusk/corpora/tree/master/data

Matchpizzatoppingsandkindsofbeers

A #topping#pizzagoesgreatwith#beer#.

Afewusefulmodifiers

Puttheseattheendofsymbolswithadotseparatingthem:

• 's'forplural,• 'ed'forpasttense,• 'capitalize'and'capitalizeAll',• '.a'toadda/aninfront

'animal.s.capitalize'willmakeananimalpluralandcapitalizeit‘pizzatoppings.a’willputa/aninfrontofit

Moreadvancedoptionscanbefoundhere:http://www.crystalcodepalace.com/traceryTut.html

2.Aworkingidea(proofofconcept)onTracery• OnTracerytogglethetabtoseetheJSONoutput• Copyandpasteittoyourtexteditor(it’llbeeasiertospoterrorsthereandaddmorevalues/data)• Thisisthe“body”ofyourbotandit’sreadytomovetotheserver

3.DedicatedTwitteraccount

• You’llneedanemail.Irecommendusingonespecificforyourbotlikemynewbot@gmail.com

• You’llneedtosignuptoTwitterwiththataccount,pickahandleandanameforyourbot.

• Verificationmightbeneededtoo

4.LogintoCheapBotsDoneQuick

• Onceloggedintoyournewbotaccountgotocheapbotsdonequick.com andclickonsigninwithTwitter

5.“Move”yourbotthere

• Onceloggedin,copypasteyourJSONoutputinthewindow

• Ifsomethingisn’tworking,you’llgetanerrormessageatthebottomindicatingtheline#(thisiseasiertofixonyourtexteditor)

• Ifeverythingisworkingyouonlyneedtosetthefrequencyforyourbottotweet,andclickonTWEET.Don’tforgettosavethechanges.

Responses

• NewfeaturesinCheapBotsDoneQuickallowyoutosetupresponseswhensomeonetweetsatyourbot

• Itusesthesamegrammar

HappyTweeting!