SHARE
TWEET

Untitled

a guest Oct 10th, 2019 551 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. set_time_limit(0);
  3. date_default_timezone_set('UTC');
  4. require 'vendor/autoload.php';
  5.  
  6. echo "# ################################################ #\n";
  7. echo "# \t\tInstagram Live Custom\t\t   #\n";
  8. echo "# \t\t     Version 1.0\t\t   #\n";
  9. echo "# ################################################ #\n\n";
  10.  
  11. First:
  12. echo "[+] Masukkan username anda : "; $username = trim(fgets(STDIN));
  13. echo "[+] Masukkan password anda : "; $password = trim(fgets(STDIN));
  14.  
  15. if($username && $password) {
  16.     echo "[!] Memulai login... ";
  17.     $ig = new \InstagramAPI\Instagram(false, false);
  18.     try {
  19.         $ig->login($username, $password);
  20.         echo "OK !\n\n";
  21.     } catch (\Exception $e) {
  22.         echo '[?] Something went wrong: '.$e->getMessage()."\n";
  23.         exit(0);
  24.     }
  25.     echo "[+] Masukkan live instagram link (isdb.pw / dkk) : "; $linkvideo = trim(fgets(STDIN));
  26.     try {
  27.         echo "\n===Comment===\n";
  28.         $ffmpegPath = null;
  29.         $ffmpeg = \InstagramAPI\Media\Video\FFmpeg::factory($ffmpegPath);
  30.         $stream = $ig->live->create();
  31.         $broadcastId = $stream->getBroadcastId();
  32.         $ig->live->start($broadcastId);
  33.         $streamUploadUrl = $stream->getUploadUrl();
  34.         $broadcastProcess = $ffmpeg->runAsync(sprintf(
  35.             '-rtbufsize 256M -re -i %s -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 720x1280 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv %s',
  36.             \Winbox\Args::escape($linkvideo),
  37.             \Winbox\Args::escape($streamUploadUrl)
  38.         ));
  39.  
  40.         $lastCommentTs = 0;
  41.         $lastLikeTs = 0;
  42.         do {
  43.             $commentsResponse = $ig->live->getComments($broadcastId, $lastCommentTs);
  44.             $systemComments = $commentsResponse->getSystemComments();
  45.             $comments = $commentsResponse->getComments();
  46.             if (!empty($systemComments)) {
  47.                 $lastCommentTs = $systemComments[0]->getCreatedAt();
  48.             }
  49.             if (!empty($comments) && $comments[0]->getCreatedAt() > $lastCommentTs) {
  50.                 $lastCommentTs = $comments[0]->getCreatedAt();
  51.             }
  52.             if(!empty($comments)) {
  53.                 foreach ($comments as $comment) {
  54.                     echo "@".$comment->getUser()->getUsername()." comment. ' ".$comment->getText()." '\n";
  55.                 }
  56.             }
  57.             $heartbeatResponse = $ig->live->getHeartbeatAndViewerCount($broadcastId);
  58.             if ($heartbeatResponse->isIsPolicyViolation() && (int) $heartbeatResponse->getIsPolicyViolation() === 1) {
  59.                 echo 'Instagram has flagged your content as a policy violation with the following reason: '.($heartbeatResponse->getPolicyViolationReason() == null ? 'Unknown' : $heartbeatResponse->getPolicyViolationReason())."\n";
  60.                 if (true) {
  61.                     $ig->live->getFinalViewerList($broadcastId);
  62.                     $ig->live->end($broadcastId, true);
  63.                     exit(0);
  64.                 }
  65.                 $ig->live->resumeBroadcastAfterContentMatch($broadcastId);
  66.             }
  67.             $likeCountResponse = $ig->live->getLikeCount($broadcastId, $lastLikeTs);
  68.             $lastLikeTs = $likeCountResponse->getLikeTs();
  69.             $ig->live->getJoinRequestCounts($broadcastId);
  70.             sleep(2);
  71.         } while ($broadcastProcess->isRunning());
  72.         $ig->live->getFinalViewerList($broadcastId);
  73.         $ig->live->end($broadcastId);
  74.         $ig->live->addToPostLive($broadcastId);
  75.     } catch (\Exception $e) {
  76.         echo 'Something went wrong: '.$e->getMessage()."\n";
  77.     }
  78. } else {
  79.     echo "\n";
  80.     goto First;
  81. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top