• PORTFOLIO
  • PERSONAL PROJECTS
  • About
Menu

Beste Saylar

BESTE SAYLAR
  • PORTFOLIO
  • PERSONAL PROJECTS
  • About
wallpapertip_global-warming-wallpaper_547951.jpg

Twitter Bot

October 19, 2020

This week’s assignment was to create a bot. I wanted to create a bot that serves to a meaningful purpose so I created a twitter bot that searches for recent global warming hash tags and grabs that tweet and retweet them  on bot’s account once an hour to create global awareness.

I used Twitter api to create this bot application. In order the create the project I needed node.js. Here’s the link for twitter developper API referance page for search tweets. Reference Page

In the twitter developper platform, I’ve reached the parameters where I’m gonna provide into my objects. 

The q was for what I need for actually search for the hash tag which is ‘#globalwarming’ and the result type was what I needed to access like next, popular or recent tweets. I preferred to search for recent tweets because of my purpose was to create awareness on recent global warming related events. Count was another parameter I needed to count how many tweets I need to grab which I grab just one to not over crowed.

Screen Shot 2020-10-19 at 3.08.32 PM.png
Screen Shot 2020-10-19 at 3.10.51 PM.png

Than I needed to get request in order to get the latest tweets. To do it I’ve used get() method, which needs the path that you I need to submit to the actual twitter API path, the parameters and a callback holding an error and a response with the fetch data from the Twitter database.

console.log( 'Something went wrong!');.png

Data statuses is the array that holds the tweets that I grabbed from Twitter database which I only have one count.

To retweet I needed to make post request to the server. I used “tweet.id_str” for id. And the request itself is actually doing everything for you all I needed to return() it. And I put all of them in retweet function to call. 

Twitter retweet reference page

Retweet.png

Last thing I did was to setInterval() to run the retweet function every hour. 

Here some tweet I got;

Screen Shot 2020-10-19 at 4.01.28 PM.png
Screen Shot 2020-10-19 at 4.01.18 PM.png
Screen Shot 2020-10-19 at 4.27.41 PM.png
Screen Shot 2020-10-19 at 4.27.30 PM.png

Link for my Twitter Bot account

Github link for the code

← The Fairy Tale StoryWord Cloud →

Latest Posts

Featured
Jan 19, 2023
Jan 19, 2023
Jan 19, 2023
Jan 19, 2023
P5.JS Pose Detection
Jan 19, 2023
Jan 19, 2023
Dec 11, 2019
ICM FINAL
Dec 11, 2019
Dec 11, 2019
Nov 20, 2019
SOUND COMPOSITION
Nov 20, 2019
Nov 20, 2019
Nov 6, 2019
Week 9_assignment
Nov 6, 2019
Nov 6, 2019
Nov 2, 2019
Working with Pixels
Nov 2, 2019
Nov 2, 2019
Oct 21, 2019
MIDTERM PROJECT-ICM
Oct 21, 2019
Oct 21, 2019
Oct 11, 2019
Breaking code out of setup() and draw() into functions
Oct 11, 2019
Oct 11, 2019
Sep 28, 2019
MAKING A GALAXY WITH LOOPS
Sep 28, 2019
Sep 28, 2019
Sep 23, 2019
Working on rule-based animation in pairs_week3
Sep 23, 2019
Sep 23, 2019