Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-23-2011, 01:00 PM   #1
d-null
. . .
 
d-null's Avatar
 
Industry Role:
Join Date: Apr 2007
Location: NY
Posts: 13,724
is it possible to use php to extract a youtube video?

I am wondering if it is possible to use a very short php script to download the flv of a youtube video straight to my server. Just want to do one video, so I can hardcode the youtube url in the short script, doesn't have to be any fancy interface or anything

anyone have any ideas on this?
d-null is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 01:08 PM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
do you have access to the shell?

theirs a good python script called youtube_dl
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 01:58 PM   #3
Vendzilla
Biker Gnome
 
Vendzilla's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: cell#324
Posts: 23,200
Use Firefox, right click, view page info, click on media and then click on the swf file and save
__________________
Carbon is not the problem, it makes up 0.041% of our atmosphere , 95% of that is from Volcanos and decomposing plants and stuff. So people in the US are responsible for 13% of the carbon in the atmosphere which 95% is not from Humans, like cars and trucks and stuff and they want to spend trillions to fix it while Solar Panel plants are powered by coal plants
think about that
Vendzilla is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 02:55 PM   #4
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by Vendzilla View Post
Use Firefox, right click, view page info, click on media and then click on the swf file and save
i think he wants it to his server, not desktop.

here is youtube_dl in action

Code:
[chris@jumbo ~]$ youtube-dl https://youtube.com/watch?v=SbasOIcGjqs
[youtube] Setting language
[youtube] SbasOIcGjqs: Downloading video webpage
[youtube] SbasOIcGjqs: Downloading video info webpage
[youtube] SbasOIcGjqs: Extracting video information
[download] Destination: SbasOIcGjqs.mp4
[download] 100.0% of 3.61M at  559.66k/s ETA 00:00
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 03:03 PM   #5
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 22,054
Sites like clipnabber.com require you to paste the source code in... Makes me believe there must be an easy formula to pull the mp4 url from the code.
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 03:57 PM   #6
Vendzilla
Biker Gnome
 
Vendzilla's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: cell#324
Posts: 23,200
Quote:
Originally Posted by fris View Post
i think he wants it to his server, not desktop.

here is youtube_dl in action

Code:
[chris@jumbo ~]$ youtube-dl https://youtube.com/watch?v=SbasOIcGjqs
[youtube] Setting language
[youtube] SbasOIcGjqs: Downloading video webpage
[youtube] SbasOIcGjqs: Downloading video info webpage
[youtube] SbasOIcGjqs: Extracting video information
[download] Destination: SbasOIcGjqs.mp4
[download] 100.0% of 3.61M at  559.66k/s ETA 00:00
He said one video, why get s script for one video?
Put it on your desktop, upload to your server, nothing complicated
__________________
Carbon is not the problem, it makes up 0.041% of our atmosphere , 95% of that is from Volcanos and decomposing plants and stuff. So people in the US are responsible for 13% of the carbon in the atmosphere which 95% is not from Humans, like cars and trucks and stuff and they want to spend trillions to fix it while Solar Panel plants are powered by coal plants
think about that
Vendzilla is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 05:04 PM   #7
d-null
. . .
 
d-null's Avatar
 
Industry Role:
Join Date: Apr 2007
Location: NY
Posts: 13,724
Quote:
Originally Posted by fris View Post
i think he wants it to his server, not desktop.
correct

no shell access

hoping to figure out a way to do it with php
d-null is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 06:45 PM   #8
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by Vendzilla View Post
He said one video, why get s script for one video?
Put it on your desktop, upload to your server, nothing complicated
ya of course its simple, but he still wants to do it via php ;)
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2011, 07:11 PM   #9
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by d-null View Post
correct

no shell access

hoping to figure out a way to do it with php
try this.

Code:
<?php

  class youtube
  {
      var $cookies;
      var $mgr;
      var $req;
      var $debug = true;
      var $auth = false;
      
      function youtube()
      {
      }
      function download($video_id)
      {
          $url = "https://youtube.com/watch?v=" . $video_id;
          $this->req =& new HTTP_Request($url);
          $response = $this->req->sendRequest();
          if (PEAR::isError($response)) {
              $response->getMessage() . "\n";
          } else {
              $page = $this->req->getResponseBody();
              $vpattern = '/v=(.*?)&/';
              preg_match($vpattern, $page, $mv);
              echo "<br />Video ID:" . $v_id = $mv[1];
              $tpattern = '/&t=(.*?)&/';
              preg_match($tpattern, $page, $tickets);
              echo "<br />Token ID:" . $token = $tickets[1];
              $curl = "video_id=";
              $curl .= $v_id;
              $curl .= "&t=";
              $curl .= $token;
              $url = "https://youtube.com/get_video?" . $curl;
              if ($this->debug)
                  return $url;
          }
      }
  }
  
  function getPatternFromUrl($url)
  {
      $url = $url . '&';
      $pattern = '/v=(.+?)&+/';
      preg_match($pattern, $url, $matches);
      return($matches[1]);
  }
  
  function GrabFlvFromYoutube($pattern)
  {
      $tube = new youtube();
      $flv_http_path = $tube->download($pattern);
      echo "<br/>Complete URL:" . $flv_http_path;
      set_time_limit(0);
      
      $data = file_get_contents($flv_http_path);
      $new_flv_path = dirname(_FILE_) . '/flvs/' . $pattern . '-' . time() . '.flv';
      echo "<br />File uploaed:";
      file_put_contents($new_flv_path, $data);
      return $new_flv_path;
  }
  
  // here is url of youtube video
  $url = $_POST['url'];
  $pattern = getPatternFromUrl($url);
  $flv_path = GrabFlvFromYoutube($pattern);
  echo "File Successfully Downloaded at:" . $flv_path . "<br/>";
  
?>
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2011, 12:29 AM   #10
Angry Jew Cat - Banned for Life
(felis madjewicus)
 
Industry Role:
Join Date: Jul 2006
Location: In Mom & Dad's Basement
Posts: 20,368
Try scraping the youtube URL for the appropriate data and dropping it into this URL structure, then downloading. http://www.ehow.com/how_4685059_youtube-mp-video.html
Angry Jew Cat - Banned for Life is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2011, 06:18 AM   #11
cherrylula
lol
 
cherrylula's Avatar
 
Industry Role:
Join Date: Jan 2002
Posts: 15,969
Where's all the heros bitching about stealing content? lol @ this thread
cherrylula is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2011, 06:26 AM   #12
Fletch XXX
GFY HALL OF FAME DAMMIT!!!
 
Fletch XXX's Avatar
 
Join Date: Jan 2002
Location: that 504
Posts: 60,840
5+ years ago this woulda be a 6 page thread of shit flinging
__________________

Want an Android App for your tube, membership, or free site?

Need banners or promo material? Hit us up (ICQ Fletch: 148841377) or email me fletchxxx at gmail.com - recent work - About me
Fletch XXX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2011, 07:02 AM   #13
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by cherrylula View Post
Where's all the heros bitching about stealing content? lol @ this thread
well as long as you dont use the videos dl'd from youtube for profit, i dont see any reason why you cant download them for offline viewing, i use an app called mxtube on my ipod which lets me grab yt vids for offline viewing.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2011, 07:08 AM   #14
cherrylula
lol
 
cherrylula's Avatar
 
Industry Role:
Join Date: Jan 2002
Posts: 15,969
Quote:
Originally Posted by fris View Post
well as long as you dont use the videos dl'd from youtube for profit, i dont see any reason why you cant download them for offline viewing, i use an app called mxtube on my ipod which lets me grab yt vids for offline viewing.
oh, not for profit. yeah this board is for technical hobbyists, I forgot....

and some more!

... but it's ok, I clicked this thread to learn too! thanks everyone.
cherrylula is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2011, 10:26 PM   #15
d-null
. . .
 
d-null's Avatar
 
Industry Role:
Join Date: Apr 2007
Location: NY
Posts: 13,724
Quote:
Originally Posted by fris View Post
try this.

Code:
<?php

  class youtube
  {
      var $cookies;
      var $mgr;
      var $req;
      var $debug = true;
      var $auth = false;
      
      function youtube()
      {
      }
      function download($video_id)
      {
          $url = "https://youtube.com/watch?v=" . $video_id;
          $this->req =& new HTTP_Request($url);
          $response = $this->req->sendRequest();
          if (PEAR::isError($response)) {
              $response->getMessage() . "\n";
          } else {
              $page = $this->req->getResponseBody();
              $vpattern = '/v=(.*?)&/';
              preg_match($vpattern, $page, $mv);
              echo "<br />Video ID:" . $v_id = $mv[1];
              $tpattern = '/&t=(.*?)&/';
              preg_match($tpattern, $page, $tickets);
              echo "<br />Token ID:" . $token = $tickets[1];
              $curl = "video_id=";
              $curl .= $v_id;
              $curl .= "&t=";
              $curl .= $token;
              $url = "https://youtube.com/get_video?" . $curl;
              if ($this->debug)
                  return $url;
          }
      }
  }
  
  function getPatternFromUrl($url)
  {
      $url = $url . '&';
      $pattern = '/v=(.+?)&+/';
      preg_match($pattern, $url, $matches);
      return($matches[1]);
  }
  
  function GrabFlvFromYoutube($pattern)
  {
      $tube = new youtube();
      $flv_http_path = $tube->download($pattern);
      echo "<br/>Complete URL:" . $flv_http_path;
      set_time_limit(0);
      
      $data = file_get_contents($flv_http_path);
      $new_flv_path = dirname(_FILE_) . '/flvs/' . $pattern . '-' . time() . '.flv';
      echo "<br />File uploaed:";
      file_put_contents($new_flv_path, $data);
      return $new_flv_path;
  }
  
  // here is url of youtube video
  $url = $_POST['url'];
  $pattern = getPatternFromUrl($url);
  $flv_path = GrabFlvFromYoutube($pattern);
  echo "File Successfully Downloaded at:" . $flv_path . "<br/>";
  
?>
thanks for this fris

I'm playing with it but still getting 500 errors, is there something I am missing if trying to run the above as it is?


and I'm not doing this to "steal" any content for those that voiced concern
d-null is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.