Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a javascript program that uses twitter API to \"scrape\" tweets off of a

ID: 3586124 • Letter: T

Question

This is a javascript program that uses twitter API to "scrape" tweets off of a user's profile and output the text. I only want this script to output the lines that do not start with "RT @." In other words, I only want the program to output the tweets tweeted by the profile and not to output the retweets on the profile. This needs to work for other situations so setting i to "9" won't help. Please see the code and the output below.

Here is the output of the code above:

I only want the output to output the lines that do not contain "RT @"!!! Please help!!

var handle = 'myiostsoul'; T.get('statuses/user_timeline', ( screen_name: handle, count: 20, exclude_replies: true, function (err, data, response) if (data) for (var 1.0 ; 1data.length; 1++) console.log (data[i].text); L1)

Explanation / Answer

Solution:

put an if condition inside for loop which will check 4 conditions.

fo

if(data[0] == 'R' && data[1]== 'T' &&data[2] == ' ' && data[3]== '@' )

{

i= 5;

}

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote