Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Film z Youtube na serwer
qbas-s
post
Post #1





Grupa: Zarejestrowani
Postów: 304
Pomógł: 1
Dołączył: 28.06.2009

Ostrzeżenie: (0%)
-----


Jak można ściągnąć film z youtube na serwer? nie chodzi mi o zastosowanie <iframe /> tylko chcę aby plik video znalazł się na moim serwerze.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
wNogachSpisz
post
Post #2





Grupa: Zarejestrowani
Postów: 1 233
Pomógł: 87
Dołączył: 6.03.2009

Ostrzeżenie: (40%)
XX---


Widze sami specjaliści.. przecież youtube dostarcza API do takich rzeczy..

  1. private function _get_links() {
  2.  
  3. $output = array();
  4. #$video_id = $this->parent->info['video_id'];
  5. $video_id = $this->id;
  6. $info_url = "http://www.youtube.com/get_video_info?video_id={$video_id}";
  7.  
  8. //$request =& $this->parent->request;
  9. $request = new HTTP_Request2;
  10. $request->setUrl( $info_url );
  11. $request->setMethod( HTTP_Request2::METHOD_GET );
  12.  
  13. $response = $request->send();
  14. $response_body = $response->getBody();
  15.  
  16. $video_info;
  17. parse_str( $response_body, $video_info );
  18.  
  19. $video_links = urldecode( $video_info['url_encoded_fmt_stream_map'] );
  20. $video_links = explode( ',itag=', $video_links );
  21. $video_links[0] = ltrim( $video_links[0], 'itag=' );
  22.  
  23. # var_dump($video_links);exit;
  24.  
  25. for ( $i = 0, $j = count( $video_links ); $i < $j; $i++ ) {
  26.  
  27. $video_link = $video_links[$i];
  28. $video = explode( '&url=', $video_link );
  29.  
  30. // Get information of type of video
  31. preg_match('#(^|\D)'.$video[0].'/([0-9]{2,4}x[0-9]{2,4})#', $video_info['fmt_list'], $format);
  32.  
  33. // Repair link
  34. $video[1] = str_replace(array(' ', 'sig='), array('%20', 'signature='), $video[1]);
  35.  
  36. // Create array of information of video
  37. $key = $this->_formats[ $video[0] ] . '-' . $format[2];
  38. $val = array(
  39. 'format' => $this->_formats[ $video[0] ],
  40. 'resolution' => $format[2],
  41. 'url' => $video[1],
  42. );
  43. $output[ $key ] = $val;
  44. }
  45.  
  46. // sortujemy...
  47.  
  48. $output = $this->_sort_links( $output );
  49.  
  50. return $output;
  51. }


Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 15:06