Is this php script working for you guys or am I doing something wrong?

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
From here:

I paste:

PHP:
function getPatternFromUrl($url)

 {

$url = $url.'&';

$pattern = '/v=(.+?)&+/';

preg_match($pattern, $url, $matches);

return ($matches[1]);

}

GetFlvFromYoutube is the main function here, which download the flv file from youtube pattern and saves to your local machine.
The function is below:

function GrabFlvFromYoutube( $pattern )
{

 require_once ("phptube.php");

 $tube = new PHPTube ();

 $flv_http_path = $tube->download($pattern) ;

 echo $flv_http_path;

 set_time_limit(0);

 $data = file_get_contents($flv_http_path);

 $new_flv_path = dirname(_FILE_).'/flvs/'.$pattern.'.flv' ;

 file_put_contents($new_flv_path, $data);

 return $new_flv_path ;

}
into a step in a youtube video downloader template, but it does nothing.

Посмотреть вложение Download code.xml

If I may expain, at the start I'm adding the end of urls, which I scraped, to youtube.com. It may look odd, but you'd have to have a file with strings like ''watch?=38ywreo'' to get it to work. All you have to do is change it to any youtube video page url to see it in action. There's a few string splits in the middle of the template that aren't of any use but remain from the script I modified it from to make it as it is. And then at the own code section, I'm supposedly running the script from sathirs website in localhost called test.php


In case this is revealing of what may be wrong, when I visit the script in xampp it says this on the browser:

function getPatternFromUrl($url) { $url = $url.'&'; $pattern = '/v=(.+?)&+/'; preg_match($pattern, $url, $matches); return ($matches[1]); } GetFlvFromYoutube is the main function here, which download the flv file from youtube pattern and saves to your local machine. The function is below: function GrabFlvFromYoutube( $pattern ) { require_once ("phptube.php"); $tube = new PHPTube (); $flv_http_path = $tube->download($pattern) ; echo $flv_http_path; set_time_limit(0); $data = file_get_contents($flv_http_path); $new_flv_path = dirname(_FILE_).'/flvs/'.$pattern.'.flv' ; file_put_contents($new_flv_path, $data); return $new_flv_path ; }
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)