Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- $ts3_ip = 'x.x.x.x';
- $ts3_queryport = 10011;
- $ts3_user = 'serveradmin';
- $ts3_pass = 'xxxx';
- $ts3_port = 9987;
- $ts3_botname = '[ BOT ] YoutuBerzy';
- $ts3_defaultchannel = 4;
- $youtube[] = array('ytid' =>'UCdEA0f6GvkV9WiTA2EHt35w', 'tschid'=> 90, 'ytname' => 'MultiQwertPL');
- $youtube[] = array('ytid' =>'UC30jG_ooVz4bkFkOFIPhDGA', 'tschid'=> 3675, 'ytname' => 'Mistrzu');
- function check($channelid)
- {
- $page = "https://www.googleapis.com/youtube/v3/channels?part=statistics&id=".$channelid."&key=AIzaSyBdzEVRMYVv_eOLCk_3vD9oSfhiRfXUGcM";
- $page = file_get_contents($page);
- $page = json_decode($page, true);
- $page = $page['items'][0]['statistics'];
- return $page;
- }
- require("ts3admin.class.php");
- $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
- if($tsAdmin->getElement('success', $tsAdmin->connect())) {
- $tsAdmin->login($ts3_user, $ts3_pass);
- $tsAdmin->selectServer($ts3_port);
- $tsAdmin->setName($ts3_botname);
- $whoAmI = $tsAdmin->whoAmI();
- $whoAmI_ID = $whoAmI['data']['client_id'];
- $tsAdmin->clientMove($whoAmI_ID, $ts3_defaultchannel);
- while(1)
- {
- sleep(1);
- $kanaly = $tsAdmin->channelList("-topic -flags -voice -limits -icon -secondsempty"); //channellist -topic -flags -voice -limits -icon -secondsempty
- $kanaly = $kanaly['data'];
- foreach ($kanaly as $key=>$data)
- {
- foreach ($youtube as $ytdata)
- {
- if ($ytdata['tschid'] == $data['cid'])
- {
- $ytinfo = check($ytdata['ytid']);
- //print_r($ytinfo);
- //print_r($data);
- $channelinfo = $tsAdmin->channelInfo($ytdata['tschid']);
- $przednickiem = "▪ [ YT ] ▪ ";
- $channeldata = array(
- 'channel_name'=> $przednickiem.$ytdata['ytname']." (".$ytinfo['subscriberCount'].")"
- );
- if($channeldata['channel_name'] !=$channelinfo['data']['channel_name'])
- print_r($tsAdmin->channelEdit($data['cid'], $channeldata));
- $channeldata = array(
- 'channel_description'=> '[center][hr]\r\n[B][COLOR=#7a7a7a]'.$ytdata['ytname'].'[/COLOR]\r\n\r\n[COLOR=#7a7a7a]Ilość Filmików[/COLOR] \r\n[COLOR=#000000]'.$ytinfo['videoCount'].'[/COLOR][/B]\r\n\r\n[B][COLOR=#7a7a7a]Liczba Subskrypcji[/COLOR]\r\n[COLOR=#000000]'.$ytinfo['subscriberCount'].'[/COLOR]\r\n\r\n[COLOR=#7a7a7a]Wyświetlenia Na Kanale[/COLOR] \r\n[COLOR=#000000]'.$ytinfo['viewCount'].'[/COLOR][/B]\r\n\r\n[B][COLOR=#7a7a7a]Link Do Kanału[/COLOR]\r\n\r\n[url=https://www.youtube.com/channel/'.$ytdata['ytid'].'][img]http://i.imgur.com/reZARPX.png[/img][/url]\r\n[hr]'
- );
- $temp = str_replace("\/","/", $channelinfo['data']['channel_name']);
- if($channeldata['channel_description'] !=$channelinfo['data']['channel_description'])
- print_r($tsAdmin->channelEdit($data['cid'], $channeldata));
- //print_r($channeldata);
- }
- }
- }
- }
- }
- else echo "błąd połączenia z ts3";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement