Results 1 to 5 of 5
-
22nd Oct 2012, 02:41 PM #1OPMember
Php Youtube video Download Error
Error: Warning: file_get_contents(http://www.youtube.com/watch?v=VH5qQKQuuM): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home2/wepkcom1/public_html/data/leechv/functions.php on line 30
Fatal error: Error while retreiving video page in /home2/wepkcom1/public_html/data/leechv/functions.php on line 31
PHP Code:<?php
ini_set('error_reporting', -1);
ini_set('display_errors', true);
ini_set('max_execution_time', 0);
ini_set('ignore_user_abort', true);
ini_set('include_path', '.');
ini_set('user_agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox/11.0');
if ( !defined('__DIR__') ) define('__DIR__', dirname(__FILE__));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
// Youtube Developer Key
const YT_DEV_KEY = ''***************'***************';
// Facebook Application ID
const FB_APP_ID = '***************';
// Facebook Application Secret
const FB_APP_SECRET = '71fa4383bdc9459e82b7b6262be3e381';
function youtube_download($videoId, $targetDir, $jsProgressCallback = null)
{
if(!$page = file_get_contents('http://www.youtube.com/watch?v=' . $videoId)) {
trigger_error('Error while retreiving video page', E_USER_ERROR);
}
if(!preg_match("/yt\.playerConfig\s\=\s(?<config>.*?)\;\s*?yt\.setConfig/s", $page, $matches)) {
trigger_error('Unable to find PLAYER_CONFIG', E_USER_ERROR);
}
if(!$config = json_decode($matches['config'])) {
trigger_error('Malformed PLAYER_CONFIG', E_USER_ERROR);
}
$fmts = explode(',', $config->args->url_encoded_fmt_stream_map);
foreach( $fmts as $k => $v ) { parse_str($v, $fmts[$k]); }
$fmtToDl = $fmts[1];
$ch = curl_init($fmtToDl['url']);
$targetPath = $targetDir . '/' . $videoId . '.flv';
curl_setopt($ch, CURLOPT_FILE, fopen($targetPath, 'w'));
curl_setopt($ch, CURLOPT_FAILONERROR, true);
if ($jsProgressCallback) {
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($dlsize, $dled) use ($jsProgressCallback) {
static $lastUpdate = 0;
@$progress = round($dled / $dlsize * 100);
if( $progress > $lastUpdate ) {
echo "<script>{$jsProgressCallback}({$progress});</script>" . str_repeat(' ', 1024);
flush(); @ob_flush();
$lastUpdate = $progress;
}
return 0;
});
}
if (!curl_exec($ch)) {
trigger_error('Curl error:' . curl_error($ch), E_USER_ERROR);
}
return array(
'path' => $targetPath,
'type' => $fmtToDl['type'],
);
}
function youtube_upload($videoFile, $videoType, $username, $password)
{
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username, $password,
'youtube', null, 'LeechVid', null, null,
'https://www.google.com/accounts/ClientLogin'
);
$yt = new Zend_Gdata_YouTube($httpClient, 123, null, YT_DEV_KEY);
$yt->setMajorProtocolVersion(2);
$videoEntry = new Zend_Gdata_YouTube_VideoEntry;
$videoEntry->setMediaSource(
$yt->newMediaFileSource($videoFile)
->setContentType($videoType)
->setSlug('Change.Me')
);
$videoEntry->setVideoTitle('Change Me!');
$videoEntry->setVideoDescription('Edit Me!');
$videoEntry->setVideoCategory('Comedy');
$newEntry = $yt->insertEntry(
$videoEntry,
'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads',
'Zend_Gdata_YouTube_VideoEntry'
);
return $newEntry;
}
function facebook_download($fb, $videoId, $targetDir, $jsProgressCallback)
{
$video = $fb->api($videoId);
$videoSrc = $video['source'];
$ch = curl_init($videoSrc);
$targetFile = $targetDir . '/' . basename(parse_url($videoSrc, PHP_URL_PATH));
curl_setopt_array($ch, array(
CURLOPT_FILE => fopen($targetFile, 'w'),
CURLOPT_FAILONERROR => true,
CURLOPT_NOPROGRESS => false,
CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
CURLOPT_PROGRESSFUNCTION => function($dlsize, $dled) use ($jsProgressCallback)
{
static $lastUpdate = 0;
@$progress = round($dled / $dlsize * 100);
if( $progress > $lastUpdate ) {
echo "<script>{$jsProgressCallback}({$progress});</script>" . str_repeat(' ', 1024);
flush(); @ob_flush();
$lastUpdate = $progress;
}
return 0;
}
));
if (!curl_exec($ch)) {
trigger_error('Curl error:' . curl_error($ch), E_USER_ERROR);
}
return array(
'path' => $targetFile,
'type' => 'video/mp4',
);
}
function santabanta_download($videoId, $targetDir, $jsProgressCallback = null)
{
if(!$page = file_get_contents('http://www.santabanta.com/video.asp?video=' . $videoId)) {
trigger_error('Error while retreiving video page', E_USER_ERROR);
}
if(!preg_match('/clip\:\s\{\s*url\:\s\"(?<url>.*?)\"\,/s', $page, $matches)) {
trigger_error('Unable to find video url', E_USER_ERROR);
}
$ch = curl_init($matches['url']);
$targetPath = $targetDir . '/' . $videoId . '.flv';
curl_setopt($ch, CURLOPT_FILE, fopen($targetPath, 'w'));
if ($jsProgressCallback) {
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($dlsize, $dled) use ($jsProgressCallback) {
static $lastUpdate = 0;
@$progress = round($dled / $dlsize * 100);
if( $progress > $lastUpdate ) {
echo "<script>{$jsProgressCallback}({$progress});</script>" . str_repeat(' ', 1024);
flush(); @ob_flush();
$lastUpdate = $progress;
}
return 0;
});
}
if (!curl_exec($ch)) {
trigger_error('Curl error:' . curl_error($ch), E_USER_ERROR);
}
return array(
'path' => $targetPath,
'type' => 'video/x-flv',
);
}HyDra_92 Reviewed by HyDra_92 on . Php Youtube video Download Error Error: Warning: file_get_contents(http://www.youtube.com/watch?v=VH5qQKQuuM): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home2/wepkcom1/public_html/data/leechv/functions.php on line 30 Fatal error: Error while retreiving video page in /home2/wepkcom1/public_html/data/leechv/functions.php on line 31 <?php ini_set('error_reporting', -1); ini_set('display_errors', true); Rating: 5
-
22nd Oct 2012, 02:44 PM #2MemberWebsite's:
sborg.usError: Warning: whatAreYouExpecting(???) failed to make sense : HTTP request failed! HTTP/1.0 404 Not Found in /Ahem_Ahem.php on line 1
Check the Youtube Link: "This video does not exist. Sorry about that."
V3g3ta | Halcyon | Abhi
-
22nd Oct 2012, 02:51 PM #3OPMember
Now this error
Fatal error: Curl error:The requested URL returned error: 403 in /home2/wepkcom1/public_html/data/leechv/functions.php on line 88
---------- Post added at 02:51 PM ---------- Previous post was at 02:50 PM ----------
Fatal error: Curl error:Failed to connect to 2607:f8b0:4007:13::7: Network is unreachable in /home2/wepkcom1/public_html/data/leechv/functions.php on line 88
-
22nd Oct 2012, 03:20 PM #4MemberWebsite's:
sborg.usCurl error 403 means you're not allowed to access the resource - it is forbidden.
I believe it is a cookie/session issue. You might wanna contact the developer.
V3g3ta | Halcyon | Abhi
-
23rd Oct 2012, 07:25 PM #5OPMember
i think its sdk or some other problem
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Selling] Rank Your Video On No 1 Position Of Google & YouTube Now - [Video Ranking Domination]
By AcidH4X in forum ServicesReplies: 4Last Post: 17th Nov 2012, 04:54 AM -
easily download youtube video
By mafuz62 in forum General DiscussionReplies: 21Last Post: 23rd May 2012, 04:49 AM -
youtube video download help
By Black Tiger in forum General DiscussionReplies: 1Last Post: 19th Jan 2012, 12:03 AM -
Get a YouTube video URL in PHP
By JmZ in forum Web Development AreaReplies: 1Last Post: 19th Nov 2011, 09:51 PM -
[Selling] YouTube Video Shoutout, On a "famous" YouTube Account [Great for Advertising Sites]
By Goob3r in forum Completed TransactionsReplies: 19Last Post: 29th Oct 2010, 06:38 AM
themaCreator - create posts from...
Version 3.22 released. Open older version (or...