Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!strstr($html, 'https://pbs.twimg.com/profile_images/') || !strstr($html, 'followers_count":') || !strstr($html, 'friends_count":') || !strstr($html, 'statuses_count":') || !strstr($html, 'favourites_count":') || !strstr($html, 'class="ProfileHeaderCard">') || !strstr($html, '<div class="ProfileHeaderCard-birthdate') || !strstr($html, '<li class="js-stream-item stream')) continue;
- $username = explode('<title>', $html); $username = explode('@', $username[1]);
- $username = explode(')', $username[1]); $username = $username[0];
- $full_name = explode('<title>', $html); $full_name = explode('(', $full_name[1]); $full_name = $full_name[0];
- $profpic = explode('https://pbs.twimg.com/profile_images/', $html); $profpic = explode('"', $profpic[1]);
- $profpic = 'https://pbs.twimg.com/profile_images/' . $profpic[0];
- $followers = explode('followers_count":', $html); $followers = explode(',', $followers[1]); $followers = $followers[0];
- $followed = explode('friends_count":', $html); $followed = explode(',', $followed[1]); $followed = $followed[0];
- $tweets = explode('statuses_count":', $html); $tweets = explode(',', $tweets[1]); $tweets = $tweets[0];
- $likes = explode('favourites_count":', $html); $likes = explode(',', $likes[1]); $likes = $likes[0];
- $profheader = explode('class="ProfileHeaderCard">', $html); $profheader = explode('<div class="ProfileHeaderCard-birthdate', $profheader[1]); $profheader = $profheader[0];
- $profheader = preg_replace("/\r|\n/", "", $profheader);
- $profheader = str_replace(">", ">qweqwe", $profheader);
- $profheader = strip_tags($profheader);
- while (strstr($profheader, " ")) $profheader = str_replace(" ", " ", $profheader);
- while (strstr($profheader, 'qweqweqweqwe')) $profheader = str_replace("qweqweqweqwe", "qweqwe", $profheader);
- $profheader = str_replace("qweqwe", "<br />", $profheader);
- while (strstr($profheader, "<br /> <br />")) $profheader = str_replace("<br /> <br />", "<br />", $profheader);
- while (strstr($profheader, "<br /><br />")) $profheader = str_replace("<br /><br />", "<br />", $profheader);
- $profheader = substr($profheader, 6, -6);
- $profheader = str_replace("@<br />", "@", $profheader);
- $profheader = str_replace(" .", ".", $profheader);
- $profheader = str_replace("http://<br />", "http://", $profheader);
- $profheader = str_replace("https://<br />", "https://", $profheader);
- $profheader = str_replace("<br />http://", "http://", $profheader);
- $profheader = str_replace("<br />https://", "https://", $profheader);
- $profheader = str_replace("<br /> ", "<br />", $profheader);
- $profheader = str_replace(" <br />", "<br />", $profheader);
- $profheader = str_replace("<br /> <br />", "<br />", $profheader);
- $profheader = trim($profheader, "<");
- $profheader = trim($profheader, ">");
- $profheader = $full_name . ' | ' . $profheader;
- $html3 = explode('stream-items js-navigable-stream" id="stream-items-id">', $html); $html3 = $html3[1];
- $html3 = explode('</ol>', $html3); array_pop($html3); $html3 = implode('</ol>', $html3);
- while (strstr($html3, ' <li class="js-stream-item stream'))
- $html3 = str_replace(' <li class="js-stream-item stream', '<li class="js-stream-item stream', $html3);
- while (strstr($html3, "\n<li class=\"js-stream-item stream"))
- $html3 = str_replace("\n<li class=\"js-stream-item stream", '<li class="js-stream-item stream', $html3);
- $entry_a = array();
- $tweetstats = array();
- $entries = explode('</li><li class="js-stream-item', $html3);
- if (!strstr($html, '_timestamp') || !strstr($html, 'data-screen-name="') || !strstr($html, ' repl') || !strstr($html, ' like') || !strstr($html, 'data-permalink-path="') || !strstr($html, ' retweet')) continue;
- $tweeter = explode('data-screen-name="', $entry); $tweeter = explode('"', $tweeter[1]); $tweeter = $tweeter[0];
- $retweeter = '';
- if (strstr($entry, 'data-retweeter="'))
- { $retweeter = explode('data-retweeter="', $entry); $retweeter = explode('"', $retweeter[1]); $retweeter = $retweeter[0]; }
- $tweetimg = '';
- if (strstr($entry, 'data-image-url'))
- { $tweetimg = explode('data-image-url="', $entry); $tweetimg = explode('"', $tweetimg[1]); $tweetimg = $tweetimg[0]; }
- else $tweetimg = $profpic;
- $tweetlink = explode('data-permalink-path="', $entry); $tweetlink = explode('"', $tweetlink[1]); $tweetlink = 'https://twitter.com' . $tweetlink[0];
- $tweetext = '';
- if (strstr($entry, 'js-tweet-text-container">'))
- {
- $tweetext = explode('js-tweet-text-container">', $entry);
- $tweetext = explode('</div>', $tweetext[1]);
- $tweetext = $tweetext[0];
- $tweetext = preg_replace('#<span class="invisible">(.*?)</span>#', '', $tweetext);
- $tweetext = preg_replace("/\r|\n/", " ", $tweetext);
- $tweetext = str_replace(">", "> ", $tweetext);
- $tweetext = strip_tags($tweetext);
- while (strstr($tweetext, " ")) $tweetext = str_replace(" ", " ", $tweetext);
- $tweetext = str_replace(" .", ".", $tweetext);
- $tweetext = str_replace("# ", "#", $tweetext);
- $tweetext = str_replace("@ ", "@", $tweetext);
- if (strstr($tweetext, '#'))
- {
- $text_tags = explode('#' , $tweetext);
- foreach ($text_tags as $kt_tag => $t_tag)
- {
- if ($kt_tag == 0) continue;
- $t_tag = explode(' ', $t_tag);
- if (!preg_match('/[^A-Za-z0-9]/', $t_tag[0])) array_push($t_tags, rtrim($t_tag[0], '.'));
- }
- }
- if (strstr($tweetext, '@'))
- {
- $text_tags2 = explode('@' , $tweetext);
- foreach ($text_tags2 as $kt_tag2 => $t_tag2)
- {
- if ($kt_tag2 == 0) continue;
- $t_tag2 = explode(' ', $t_tag2);
- // $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
- }
- }
- }
- $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;
- if ($retweeter == '')
- {
- $t_replies = explode(' replies</span>', $entry);
- if (strstr($entry, ' reply</span>')) $t_replies = explode(' reply</span>', $entry);
- $t_replies = explode('>', $t_replies[0]); $t_replies = array_pop($t_replies);
- $t_likes = explode(' likes</span>', $entry);
- if (strstr($entry, ' like</span>')) $t_likes = explode(' like</span>', $entry);
- $t_likes = explode('>', $t_likes[0]); $t_likes = array_pop($t_likes);
- $t_retweets = explode(' retweets</span>', $entry);
- if (strstr($entry, ' retweet</span>')) $t_retweets = explode(' retweet</span>', $entry);
- $t_retweets = explode('>', $t_retweets[0]); $t_retweets = array_pop($t_retweets);
- array_push($tweetstats, array($t_replies, $t_likes, $t_retweets));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement