Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.94 KB | None | 0 0
  1. if (!strstr($html, 'https://pbs.twimg.com/profile_images/') || !strstr($html, 'followers_count&quot;:') || !strstr($html, 'friends_count&quot;:') || !strstr($html, 'statuses_count&quot;:') || !strstr($html, 'favourites_count&quot;:') || !strstr($html, 'class="ProfileHeaderCard">') || !strstr($html, '<div class="ProfileHeaderCard-birthdate') || !strstr($html, '<li class="js-stream-item stream')) continue;
  2. $username = explode('<title>', $html); $username = explode('@', $username[1]);
  3. $username = explode(')', $username[1]); $username = $username[0];
  4. $full_name = explode('<title>', $html); $full_name = explode('(', $full_name[1]); $full_name = $full_name[0];
  5. $profpic = explode('https://pbs.twimg.com/profile_images/', $html); $profpic = explode('"', $profpic[1]);
  6. $profpic = 'https://pbs.twimg.com/profile_images/' . $profpic[0];
  7. $followers = explode('followers_count&quot;:', $html); $followers = explode(',', $followers[1]); $followers = $followers[0];
  8. $followed = explode('friends_count&quot;:', $html); $followed = explode(',', $followed[1]); $followed = $followed[0];
  9. $tweets = explode('statuses_count&quot;:', $html); $tweets = explode(',', $tweets[1]); $tweets = $tweets[0];
  10. $likes = explode('favourites_count&quot;:', $html); $likes = explode(',', $likes[1]); $likes = $likes[0];
  11. $profheader = explode('class="ProfileHeaderCard">', $html); $profheader = explode('<div class="ProfileHeaderCard-birthdate', $profheader[1]); $profheader = $profheader[0];
  12. $profheader = preg_replace("/\r|\n/", "", $profheader);
  13. $profheader = str_replace(">", ">qweqwe", $profheader);
  14. $profheader = strip_tags($profheader);
  15. while (strstr($profheader, " ")) $profheader = str_replace(" ", " ", $profheader);
  16. while (strstr($profheader, 'qweqweqweqwe')) $profheader = str_replace("qweqweqweqwe", "qweqwe", $profheader);
  17. $profheader = str_replace("qweqwe", "<br />", $profheader);
  18. while (strstr($profheader, "<br /> <br />")) $profheader = str_replace("<br /> <br />", "<br />", $profheader);
  19. while (strstr($profheader, "<br /><br />")) $profheader = str_replace("<br /><br />", "<br />", $profheader);
  20. $profheader = substr($profheader, 6, -6);
  21. $profheader = str_replace("@<br />", "@", $profheader);
  22. $profheader = str_replace(" .", ".", $profheader);
  23. $profheader = str_replace("http://<br />", "http://", $profheader);
  24. $profheader = str_replace("https://<br />", "https://", $profheader);
  25. $profheader = str_replace("<br />http://", "http://", $profheader);
  26. $profheader = str_replace("<br />https://", "https://", $profheader);
  27. $profheader = str_replace("<br /> ", "<br />", $profheader);
  28. $profheader = str_replace(" <br />", "<br />", $profheader);
  29. $profheader = str_replace("<br />&nbsp;<br />", "<br />", $profheader);
  30. $profheader = trim($profheader, "<");
  31. $profheader = trim($profheader, ">");
  32. $profheader = $full_name . ' | ' . $profheader;
  33.  
  34. $html3 = explode('stream-items js-navigable-stream" id="stream-items-id">', $html); $html3 = $html3[1];
  35. $html3 = explode('</ol>', $html3); array_pop($html3); $html3 = implode('</ol>', $html3);
  36.  
  37. while (strstr($html3, ' <li class="js-stream-item stream'))
  38. $html3 = str_replace(' <li class="js-stream-item stream', '<li class="js-stream-item stream', $html3);
  39. while (strstr($html3, "\n<li class=\"js-stream-item stream"))
  40. $html3 = str_replace("\n<li class=\"js-stream-item stream", '<li class="js-stream-item stream', $html3);
  41.  
  42. $entry_a = array();
  43. $tweetstats = array();
  44. $entries = explode('</li><li class="js-stream-item', $html3);
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. if (!strstr($html, '_timestamp') || !strstr($html, 'data-screen-name="') || !strstr($html, ' repl') || !strstr($html, ' like') || !strstr($html, 'data-permalink-path="') || !strstr($html, ' retweet')) continue;
  53.  
  54. $tweeter = explode('data-screen-name="', $entry); $tweeter = explode('"', $tweeter[1]); $tweeter = $tweeter[0];
  55.  
  56. $retweeter = '';
  57. if (strstr($entry, 'data-retweeter="'))
  58. { $retweeter = explode('data-retweeter="', $entry); $retweeter = explode('"', $retweeter[1]); $retweeter = $retweeter[0]; }
  59.  
  60. $tweetimg = '';
  61. if (strstr($entry, 'data-image-url'))
  62. { $tweetimg = explode('data-image-url="', $entry); $tweetimg = explode('"', $tweetimg[1]); $tweetimg = $tweetimg[0]; }
  63. else $tweetimg = $profpic;
  64.  
  65. $tweetlink = explode('data-permalink-path="', $entry); $tweetlink = explode('"', $tweetlink[1]); $tweetlink = 'https://twitter.com' . $tweetlink[0];
  66.  
  67. $tweetext = '';
  68. if (strstr($entry, 'js-tweet-text-container">'))
  69. {
  70. $tweetext = explode('js-tweet-text-container">', $entry);
  71. $tweetext = explode('</div>', $tweetext[1]);
  72. $tweetext = $tweetext[0];
  73. $tweetext = preg_replace('#<span class="invisible">(.*?)</span>#', '', $tweetext);
  74. $tweetext = preg_replace("/\r|\n/", " ", $tweetext);
  75. $tweetext = str_replace(">", "> ", $tweetext);
  76. $tweetext = strip_tags($tweetext);
  77. while (strstr($tweetext, " ")) $tweetext = str_replace(" ", " ", $tweetext);
  78. $tweetext = str_replace(" .", ".", $tweetext);
  79. $tweetext = str_replace("# ", "#", $tweetext);
  80. $tweetext = str_replace("@ ", "@", $tweetext);
  81. if (strstr($tweetext, '#'))
  82. {
  83. $text_tags = explode('#' , $tweetext);
  84. foreach ($text_tags as $kt_tag => $t_tag)
  85. {
  86. if ($kt_tag == 0) continue;
  87. $t_tag = explode(' ', $t_tag);
  88. if (!preg_match('/[^A-Za-z0-9]/', $t_tag[0])) array_push($t_tags, rtrim($t_tag[0], '.'));
  89.  
  90.  
  91. }
  92. }
  93. if (strstr($tweetext, '@'))
  94. {
  95. $text_tags2 = explode('@' , $tweetext);
  96. foreach ($text_tags2 as $kt_tag2 => $t_tag2)
  97. {
  98. if ($kt_tag2 == 0) continue;
  99. $t_tag2 = explode(' ', $t_tag2);
  100. // $tweetext = str_replace('@' . $t_tag2[0], '<a href="https://twitter.com/' . $t_tag2[0] . '" target="_blank">@' . $t_tag2[0] . '</a>', $tweetext); // check if user is on site and link there instead
  101. }
  102. }
  103. }
  104.  
  105. $tpdts = explode('_timestamp', $entry); $tpdts = explode('>', $tpdts[1]); $tpdts = explode('<', $tpdts[1]); $tpdts = explode(' ', $tpdts[0]); $tpdts[1] = str_pad($tpdts[1], 2, "0", STR_PAD_LEFT); $tpdts = $tpdts[0] . ' ' . $tpdts[1]; $tweetext .= ' | ' . $tpdts;
  106.  
  107. if ($retweeter == '')
  108. {
  109. $t_replies = explode(' replies</span>', $entry);
  110. if (strstr($entry, ' reply</span>')) $t_replies = explode(' reply</span>', $entry);
  111. $t_replies = explode('>', $t_replies[0]); $t_replies = array_pop($t_replies);
  112.  
  113. $t_likes = explode(' likes</span>', $entry);
  114. if (strstr($entry, ' like</span>')) $t_likes = explode(' like</span>', $entry);
  115. $t_likes = explode('>', $t_likes[0]); $t_likes = array_pop($t_likes);
  116.  
  117. $t_retweets = explode(' retweets</span>', $entry);
  118. if (strstr($entry, ' retweet</span>')) $t_retweets = explode(' retweet</span>', $entry);
  119. $t_retweets = explode('>', $t_retweets[0]); $t_retweets = array_pop($t_retweets);
  120.  
  121. array_push($tweetstats, array($t_replies, $t_likes, $t_retweets));
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement