public function uploadVideo()
 {
     $videoData = array('source' => __DIR__ . '/../../public/' . 'test.avi', 'mime' => 'video/x-msvideo', 'slug' => 'test.avi', 'title' => 'Title', 'description' => 'Lorem ipsum dolor..', 'category' => 'Autos', 'tags' => 'cars, funny', 'developer_tags' => array('mydevtag', 'anotherdevtag'));
     $youtubeConfig = Config::get('gdata.youtube');
     $youtubeClient = new YoutubeClient($youtubeConfig['youtube_email'], $youtubeConfig['youtube_pass'], $youtubeConfig['api_key'], $youtubeConfig['api_name']);
     $youtubeClient->insertVideo($videoData);
     echo $youtubeClient->getVideoId();
     die;
 }
Beispiel #2
1
 /**
  * Get dev_key from db
  */
 public function __construct()
 {
     \CModule::IncludeModule("iblock");
     $arrFilter = array("IBLOCK_ID" => SOCIAL_CONFIG_IB, "PROPERTY_PROVIDER" => "Youtube", "PROPERTY_SOCIAL_ID" => $userProfile["identifier"]);
     $arSelect = array("PROPERTY_SECRET");
     $rsRes = \CIBlockElement::GetList($arOrder, $arrFilter, false, false, $arSelect);
     if ($arItem = $rsRes->GetNext()) {
         self::$dev_key = $arItem["PROPERTY_SECRET_VALUE"];
     }
 }
Beispiel #3
0
<?php

/**
 * Delete script
 */
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__) . '/../');
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
set_time_limit(0);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$youtube = new \YoutubeClient();
/*$youtube->deletePics();
$arVideos = $youtube->getArVideosByUrl();
$youtube->save($arVideos);*/
$youtube->importForChannels();
$vk = new \VkClient();
$vk->import();
die;
Beispiel #4
0
 public function import()
 {
     $arBaseChannels = $this->arBaseChannels;
     foreach ($arBaseChannels as $channel_id => $arUrls) {
         $file = self::getFilePathByChannel($channel_id);
         $arVideos = array();
         $arPersonalYoutube = array();
         $arOficialChannelYoutube = array();
         $arRutube = array();
         $arVkontakte = array();
         foreach ($arUrls as $url) {
             if (strpos($url, "youtube.com/user") !== false) {
                 $arPersonalYoutube[] = $url . "/videos";
             }
             if (strpos($url, "youtube.com/channel") !== false) {
                 $arOficialChannelYoutube[] = $url . "/videos";
             }
             if (strpos($url, "rutube.ru") !== false) {
                 $arRutube[] = $url;
             }
             if (strpos($url, "vk.com") !== false) {
                 $arVkontakte[] = $url;
             }
         }
         if (count($arPersonalYoutube) > 0) {
             foreach ($arPersonalYoutube as $url) {
                 $youtube = new \YoutubeClient();
                 $arVideos = array_merge($arVideos, $youtube->getArVideosByUrl($url));
             }
         }
         if (count($arOficialChannelYoutube) > 0) {
             foreach ($arOficialChannelYoutube as $url) {
                 $youtube = new \YoutubeClient();
                 $arVideos = array_merge($arVideos, $youtube->getArVideosByUrl($url));
             }
         }
         if (count($arRutube) > 0) {
             foreach ($arRutube as $url) {
                 $rutube = new \RutubeClient();
                 //$arVideos =  array_merge($arVideos, $rutube->getArVideosByUrl($url));
             }
         }
         self::save($arVideos, $file);
     }
 }