Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

IAE 101 – Introduction to Digital Intelligence

Fall, 2022

Programming Project 04 – Creating a Twitterbot

Description:

Twitter is a social media platform through which users can post short messages that everyone calls "tweets", but which the developers of Twitter insist are called "statuses".  Initially, the    length of tweets was restricted to 140 characters, but the limit was eventually increased to 280 characters.

Users can engage with each other and gain access to each other's status updates by following   each other.  When you log into Twitter you are presented with your home timeline, which is a  display of all the tweets sent by you and the other users that you follow, typically ordered from most recent to least recent (the default is now an algorithmic ordering that also includes tweets that match your interests and whose ordering is quite mysterious, but you can switch back to    ordering by time).

Twitter engagement and interaction takes many forms.  Some users post frequently while others post seldom or never.  Some users post the everyday minutiae of their lives.  Others engage in   extended political discussions.  Politicians, journalists, academics, celebrities, and professionals of many other types make use of Twitter to pursue their various interests.  The medium has shown remarkable versatility given the strict limits on the length of status updates.

Since early on in its existence, Twitter has also been home to automated participants, Twitterbots –programs that read and post status updates to Twitter.  These algorithmic users vary quite a bit  in their overall sophistication.  Dr. Graham discussed several examples during her lecture on Wednesday ( 11/18/2020).  I follow at least two movie related bots—one that posts the script of   the 1995 movie Hackers one line at a time, and another that posts lines from Kurt Russel's character Jack Burton from the movie Big Trouble in Little China.  However, their behavior can  be much more interesting and complex than this.

Here are some lists of popular and well-regarded Twitterbots.

•   https://blog.mozilla.org/internetcitizen/2018/01/19/10-twitter-bots-actually-make- internet-better-place/

•   http://nymag.com/intelligencer/2015/11/12-weirdest-funniest-smartest-twitter-bots.html

•   https://discover.bot/bot-talk/popular-twitter-bots-2019/

•   https://www.poynter.org/tech-tools/2017/7-of-the-best-twitter-bots-in-journalism/

Twitterbots are a kind of public performance, and they are often an interactive form of public performance in which the bot engages with the status updates posted by other users in interesting, or significant, or amusing, or beautiful ways.

For this assignment you will build a Twitterbot using Python and the Tweepy library for accessing Twitter's Application Programming Interface.  I have simplified the interface to make it easier for you all to use and to restrict the operations you can take.  Your real task is to think  about an interesting way to have your bot perform on Twitter and implement that in mytwtterbot.py.

Directions:

1. Create a new account on Twitter.

-Please set your username, it must include IAE101

-For example, IAE101105289916

-         or, IAE101_ckane

-I suggest using your name, netid, or Student ID # to ensure that each student has a unique account name for their project twitter account that fits the 15-character limit twitter imposes on usernames.

-Please use your stonybrook.edu email address when you register the account.

-Share your username with the instructors.

-I have created a Google sheet for you to enter this information.

-Also, follow the IAE101_ckane and IAE101_egraham accounts from your new project account.

2. Download the Tweepy library using pip.

-Mac: python3 -m pip install tweepy --user

-Windows: py -3 -m pip install tweepy --user

-Please try to install Tweepy right away so that any problems can be resolved as early as possible in this assignment.

3. Download the files simple_twit.py and mytwitterbot.py from Blackboard.

-simple_twit.py is the interface I have written to simplify and restrict the way you can use the Tweepy library to access Twitter.

-mytwitterbot.py is the file in which you will implement your Twitterbot.  It is already prepared for you to start making calls to Twitter's API.

-Make sure that simple_twit.py and mytwitterbot.py are always in the same folder on your computer.

4. Download and read very carefully the description of the simple_twit.py documentation. This will describe how you can engage with Twitter and other Twitter user's when building your bot.

5. Add your assigned developer credentials to mytwitterbot.py. -There are three sets of credentials assigned by last name.

-Each set of credentials is composed of a Consumer Key and a Consumer Secret.      -Assign each one to the respective all-caps variable near the top of mytwitterbot.py.  -Do not share these credentials with anyone outside the class, use only your assigned credentials, do not use them for anything other than this project.

-If we find you are misusing our Twitter developer credentials we will fail you.

6. Spend some time looking through the Tweepy documentation to see how Twitter's API is accessed from Python.

https://tweepy.readthedocs.io/en/latest/index.html

-You may see some additional functionality not available through simple_twit.py that you would like to use.  Discuss it with me and I may add it.

7. Spend some time thinking about what you might like to do with your Twitterbot.  How      would you like it to interact with Twitter and its Users?  What information from Twitter will you need in order to make those interactions work?  Sit down and write out a design for your Twitterbot.

-If you have an idea, but are not sure how to make it work, come discuss it with us, and we may be able to suggest a way to do it, or offer a similar alternative that can be done instead.

8. Implement your Twitterbot, according to your design, in the mytwitterbot.py file.

9. Your bot must adhere to Twitter's policies about acceptable behavior on their platform, especially their policies regarding automated behavior.

https://help.twitter.com/en/rules-and-policies/twitter-automation

Submission Instructions:

1. Due Monday, November 28th, 2021 – Twitterbot Design

-You must turn in a 1-page description of your design for your Twitterbot.     -Your description must be typewritten and turned in on Blackboard as a PDF.

2. Due Friday, December 2nd, 2021 – Twitter Access Demonstration:

-You must complete the following 4 exercises in you mytwitterbot.py file

1.   Retrieve and print out the 10 most recent tweets from your bot's home timeline.

2.   Retrieve and print out the 10 most recent tweets from another user's timeline.

3.   Post a single tweet to your bot's timeline.

4.   Post a single media tweet to your bot's timeline.

-Upload mytwitterbot.py to Blackboard.

2. Due Friday, December 9th, 2021 – Completed Twitterbot

-You upload an updated description of your Twitterbot design that indicates how much of your initial design you were able to implement, and your impression of how well it functions on Twitter.

-You must upload your mytwitterbot.py file containing your completed Twitterbot.