This is a javascript program that uses twitter API to \"scrape\" tweets off of a
ID: 3586126 • 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
<!-- Please read this comment.
Replace your function with this:
function(err, data, response){
if(data){
for(var i=0;i<data.length.i++){
var sentence=data[i].text;
if(!sentence.startsWith("RT @")){
console.log(sentence);
}
}
}
}
A demo program is given below for sample testing.
-->
<script>
var sentence1="RT @HorrorBible: icons of horror";
var sentence2="I love programming";
if(!sentence1.startsWith("RT @")){
console.log(sentence1);
}
if(!sentence2.startsWith("RT @")){
console.log(sentence2);
}
</script>
<p>Hello</p>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.