Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 30, 2020 02:38 pm GMT

Tutorial: Creating a COVID-19 Twitter Bot

We love when our Community members share how they are using WayScript. Erik Toor created this great video using Python and WayScript, and below is a step by step tutorial. If you'd like to share what you're building with WayScript, let us know.

Introduction

With everything that's been going on in the world there is a need for easily accessible public information during COVID-19. Today, we'll be discussing how a college student, Erik Toor, used WayScript to help make information for COVID-19 more accessible.

Making a COVID-19 TwitterBot

In order to make the TwitterBot, Erik utilizes a Time Trigger, a Python Script, and our Twitter Plugin. To code something like Erik there are no prerequisites but some content you might find helpful:
Working with Twitter
Working with Python

Building the Script

With WayScript, you can set up a workflow fairly quickly.
You can create a workflow by clicking the + New Script Button in the top right corner of the website.

In Erik's Script, to make a workflow he using the Time-Trigger module, Erik allows himself to Tweet COVID-19 updates daily. Modules are sort of like building blocks, to help form the foundation of our application. Then through adding the Twitter Module, and signing in one-tap with his Twitter, he is ready to post Tweets.

Twitter Module

After creating the workflow, Erik edits the Python Module's code so that he can write up his steps for creating COVID-19 updates.

Note: Python code can be found in his script you can clone
Twitter Bot COde

To edit, a Python Module once you have placed it in your workflow, just click the Python Module > Hover Over scratch.py > Edit Code. Then you can change the Python Code however, you want!

In Erik's Python Module, he defined a Function getCovidInfo(country), which gets information based off the country you request. Because he uses the loop module later in his workflow, he can add unlimited tweets for unlimited countries so that anyone can get information on COVID-19 cases in their country.

Twitter Bot Code

You can download any Python library you need with WayScript automatically! Here, Erik writes helper functions to make web requests with Python and format his tweet. He imports urllib.request and json. He uses the urllib.request library to request data from an API written by students at his school called TrackCorona.live.

Result

Erik is able to tweet daily updates for coronavirus. Good work! If you want to checkout Erik's full video, see the link below.

Twitter Feed

Video

Check out the step-by-step tutorial on Erik's YouTube Channel

If you would like to see Erik's workflow or work with his script, it is public on the WayScript market place. Also feel free to check out other scripts on the WayScript Market Place.


Original Link: https://dev.to/wayscript/tutorial-creating-a-covid-19-twitter-bot-2i07

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To