Last active
May 24, 2020 13:05
-
-
Save alxgrk/04aca506297ddab50ded29152af00744 to your computer and use it in GitHub Desktop.
Twitter-User Scroll-Timeline-Algorithm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while( timeOfUseLessThan(30minutes) && endOfTimelineNotReached() ) { | |
currentTweet = scrollOverTweets(Random(1, 10)) | |
// simulate reading current tweet | |
waitRandomBetween(1second, 10seconds) | |
// click depending on kind of tweet | |
// not always clicking, since seeing the preview might be enough | |
if (currentTweet.contains(Images) && Random(0, 1) <= 0.5 ) { | |
currentTweet.viewImages() | |
} | |
if (currentTweet.contains(Video) && Random(0, 1) <= 0.3 ) { | |
currentTweet.viewVideo() | |
} | |
if (currentTweet.contains(Link) && Random(0, 1) <= 0.3 ) { | |
currentTweet.clickLink() | |
// simulate reading link's content | |
waitRandomBetween(30seconds, 5minutes) | |
} | |
// reasons to click for details | |
if (currentTweet.isThread() && Random(0, 1) <= 0.4) { | |
currentTweet.clickDetailView() | |
// simulate reading thread | |
waitRandomBetween(20seconds, 3minutes) | |
} | |
if (currentTweet.hasComments() && Random(0, 1) <= 0.4) { | |
currentTweet.clickDetailView() | |
// simulate reading comments | |
waitRandomBetween(10seconds, 2minutes) | |
} | |
if (currentTweet.containsHashtags() && Random(0, 1) <= 0.2) { | |
// clicking on hashtag initiates new (shortened) scroll session | |
currentTweet.clickOnRandomHashtagAndViewRelatedTweets() | |
} | |
if (Random(0, 1) <= 0.1) { | |
// viewing author's profile could also lead to a new scroll session | |
viewAuthorsProfile() | |
} | |
if (authorNotAlreadyFollowed() && Random(0, 1) <= 0.05) { | |
directlyFollowAuthor() | |
} | |
// other actions like participateInSurvey() possible… | |
// other direct interactions with tweet | |
// retweeting with probability of 40% | |
r = Random(0, 1) | |
if ( r <= 0.3 ) { | |
currentTweet.retweet() | |
} else if ( r <= 0.4 ) { | |
currentTweet.retweetWithComment() | |
} | |
// liking with same probability as for retweeting | |
if ( Random(0, 1) <= 0.4 ) { | |
currentTweet.like() | |
} | |
if ( Random(0, 1) <= 0.1 ) { | |
currentTweet.reply() | |
} | |
if ( Random(0, 1) <= 0.1 ) { | |
currentTweet.shareExternally() | |
} | |
returnToTimeline() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment