Making and Using a Twitter Bot

By James Harry Morris with thanks to Callum Morris.

In August 2018, I developed the Kirishitan Collector Bot, a Twitter Bot that retweets content based on keyword searches pertaining to 16th and 17th Century Japanese Christianity. The term Kirishitan refers to 16th and 17th Century Japanese Roman Catholicism and the adherents of that religion. I created the account and the associated bot so that I could easily keep up-to-date with popular and academic developments related to my research field, and in order to increase the content related to my research field on my Twitter profile.

Currently, the bot searches for the following keywords in English and Japanese; Kirishitan and its various spellings (キリシタン, 吉利支丹, 切支丹); Kakure Kirishitan (カクレキリシタン, 隠れキリシタン, 隠れ切支丹); Senpuku Kirishitan (潜伏切支丹, 潜伏キリシタン); Kirishitan danatsuキリシタン弾圧; Kirishitan ji キリシタン寺; Kirishitan daimyō キリシタン大名; Shūmon aratame 宗門改; Shūmon ninbetsu aratame 宗門人別改; Shūmon aratame yaku 宗門改役; Kirishitan seiki キリシタン世紀; Kirishitan banキリシタン版; Shimabara no ran 島原の乱; and the name Takayama Ukon 高山右近. In a previous iteration, it also searched for terms relating to the Jesuits and martyrdom, however, I found that this often resulted in retweets unrelated to my field of interest. The bot does not retweet all the content that it finds due to restrictions derived from the service that I used to create it, however, it performs around 500 API searches per day, posting every hour or so, and accumulating around 120 to 140 retweets per day. The content it retweets tends to be a balance between news stories and personal tweets containing the keywords. It also occasionally posts academic content. The news stories, academic content and some personal tweets (such as those from people visiting sites related to the Kirishitan) are useful for following the trends in my research field, however, most personal tweets although an interesting read, are not particularly useful for my purposes. Nevertheless, the bot’s retweeting of these personal tweets is inevitable and results from what the Twitter Bot does and how it works.

Screen Shot 2018-10-17 at 19.05.10

An image of the Kirishitan Collector Bot (October 2018).

In order to create the bot, I had a choice of coding it in python or java, or using a service in order to create it. After initial research online, it seemed that many people tended to recommend the use of the service Bot Libre which allows users to create bots without using code and hosts the bot for free. Although coding a Twitter Bot is not a difficult task, with numerous online guides and free source code available, I decided to use the service to test my idea. Following the initial test, I found that Bot Libre’s service was more than adequate for my purposes and therefore I chose not to proceed with coding the bot myself. I followed Bot Libre’s own guide to create the bot, performing my own testing of keywords, and monitoring and tweaking of the account in the following weeks.

Screen Shot 2018-10-17 at 19.13.49

An image of Bot Libre‘s page on the bot.

Since the Kirishitan Collector Bot basically spams tweets to its own account, Twitter initially blocked it. After getting the account unblocked via a text message, I followed the advice of the online community and set the profile to “protected” meaning that people must follow and receive the account’s permission in order to view its feed. This is a shame as I believe the account would gain a wide followership amongst interested parties if it were public. Another problem I found was that the bot occasionally posts unrelated tweets containing the characters “kiri” きり. I have attempted to fix this through various small tweaks such as removing the search term kirishitan when rendered in hiragana (きりしたん), however, such attempts have only had limited success. Nevertheless, this does not pose a major problem since the bot’s accidental retweets are minimal and the vast majority of its posts relate to my research area.

Screen Shot 2018-10-17 at 19.14.44

Part of the Bot Libre interface.

The data that a Twitter Bot gathers can be used for research purposes. A bot’s account history can be easily downloaded, allowing the creator to analyze the data that the bot has collected. After the bot’s archive is downloaded on Twitter, one can access the data in CSV, JS, and numerous other formats. Other methods of collecting data from Twitter, such as using code in order to search Twitter’s API directly, hold some advantages over bots. For example, whereas a bot, like my own, gathers data over an extended period, an API search allows the researcher to access all relevant tweets instantaneously. There are also services for searching Twitter’s API such as BackTweetsOmniSci’s Tweet Mapand Trendsmap, However, I have found all such services useless for searching for tweets on the Kirishitan.

Creating a Twitter Bot using services such as Bot Libre is a very simple process, which can help academics in all fields keep abreast of developments in their fields or provide valuable data for their research purposes. I have found the process of creating a bot (which took less than an hour) and using it particularly beneficial, and I imagine other researchers either involved in the digital humanities or on its fringes may find benefit in creating their own bots related to their respective research areas. Reposting interesting tweets that the Kirishitan Collector Bot has discovered has allowed me to drastically increase the academic content on my Twitter account, which is most pleasing since the primary reason I joined Twitter was to share details of my research and engage with other scholars. As such, in early September, I created another Twitter Bot, the Syriac Christianity Bot, in order to retweet posts in English, Japanese, and Chinese from a second area of academic interest; Syriac Studies and Syriac Christianity. However, the content related to this area on twitter seems to be sparse and therefore the Syriac Christianity Bot has not been particularly successful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: