numRowsCount("SELECT * FROM orjinal_videos WHERE orjinal_url='" . $url . "'") == 0){
//writeFile('./downloadFileList.txt', $url);
$parser = detectDownloader($url);
echo "".strtoupper($parser)."
\n";
if(file_exists("classes/$parser.class.php")){
include_once "classes/$parser.class.php";
}
$video = new video($url);
if($parser == 'youtube' and $video->isPlaylist()){
$playlist = $video->getPlaylistVideoId(true);
foreach($playlist as $vidId){
$videox = new video("https://www.youtube.com/watch?v=".$vidId);
$vidData = $videox->getVideoInfo();
echo "
".$vidData['title']."
Yükle
\n";
unset($videox);
}
exit;
}
else if($parser == 'youtube' and $video->isChannel()){
$channellist = $video->getChannelVideoId(true);
foreach($channellist as $vidId){
$videox = new video("https://www.youtube.com/watch?v=".$vidId);
$vidData = $videox->getVideoInfo();
echo "
".$vidData['title']."
Yükle
\n";
unset($videox);
}
exit;
}
$data = $video->getResult();
if($db->numRowsCount("SELECT * FROM videos WHERE title='".$db->clean($data['title'])."'") > 0){
die('Bu isimde bir video zaten yüklenmiş.');
}
if($parser == 'youtube' and $data['length'] > 1000){
$data['video_url'] = '';
}
if(urlExists($data['video_url'])){
$downloadCounter = DOWNLOAD_COUNTER;
$downloadStatus = false;
while($downloadCounter){
if($video->download()){
echo "Dosya indirildi. OK
\n";
echo "Dosya : " . DOWNLOAD_DIR . $data['video_file_name'] . " (" . byteCalc(filesize(DOWNLOAD_DIR . $data['video_file_name'])) . ")
\n";
$downloadCounter = 0;
$downloadStatus = true;
}
else{
$downloadCounter--;
sleep(1);
}
}
}
if($downloadStatus){
try{
require "includes/sdk/Dailymotion.php";
$api = new Dailymotion();
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
DAILY_KEY,
DAILY_SECRET,
array('read', 'write', 'manage_videos'),
array('username' => DAILY_USERNAME, 'password' => DAILY_PASSWORD)
);
/*
//-> Generate tags
$convertToLang = array('tr', 'en', 'fr');
$currentLangDesc = langDetect($data['description']);
$convText = array();
foreach($convertToLang as $lngx){
if($currentLangTitle != $lngx){
$convText['title'][] = yandexCeviri($data['title'], $currentLangTitle, $lngx);
}
}
foreach($convertToLang as $lngx){
if($currentLangDesc != $lngx){
$convText['desc'][] = yandexCeviri($data['title'], $currentLangDesc, $lngx);
}
}
*/
$currentLangTitle = langDetect($data['title']);
$vvii = realpath(DOWNLOAD_DIR . $data['video_file_name']);
$urlx = $api->uploadFile($vvii);
$videoPostData = array(
'url' => $urlx,
'title' => $data['title'],
'tags' => genVideoTag(genTranslateContent($data['title'], " ")),
'description'=> genTranslateContent($data['description']),
'channel' => ($videoCategory!=''?$videoCategory:'webcam'),
'language' => $currentLangTitle==false?'tr':$currentLangTitle,
'published' => true,
);
$resultx = $api->post('/me/videos', $videoPostData);
if(!$resultx){
throw new Exception("".var_export($resultx, true)."
");
}
if(isset($resultx['id']) and $resultx['id'] != ''){
echo "".$resultx['title']."
";
echo "".var_export($videoPostData, true)."
\n";
echo 'YÜKLEME BAŞARILI! :)
';
$db->query("INSERT INTO orjinal_videos (orjinal_url, video_file, image_url, title, content, status, dailymotion_id, indate) VALUES ('".$url."', '".$data['video_file_name']."', '".$data['picture_url']."', '".$db->clean($data['title'])."', '".$db->clean($data['description'])."', '1', '".$resultx['id']."', '".time()."')");
$lastInsertId = $db->insertId();
$insertVideosSql = "INSERT INTO videos (dailymotion_id, title, descr, tags, lang, orj_id, indate, dailymotion_channel, duration) VALUES ('".$resultx['id']."', '".$db->clean($videoPostData['title'])."', '".$db->clean($videoPostData['description'])."', '".$db->clean($videoPostData['tags'])."', '".$videoPostData['language']."', '".$lastInsertId."','".time()."', '".DAILY_USERNAME."', '".(isset($data['length'])?$data['length']:'0')."')";
//echo $insertVideosSql;
$db->query($insertVideosSql);
}
else{
echo 'VİDEO YÜKLENEMEDİ. :(
';
}
if(file_exists(DOWNLOAD_DIR . $data['video_file_name'])){
sleep(3);
unlink(DOWNLOAD_DIR . $data['video_file_name']);
}
}catch(Exception $e) {
echo $e->getMessage();
}
}
else{
echo "Dosya indirilemedi. ERROR
\n";
}
if(isset($_REQUEST['exit'])){
echo "";
}
}