wget insteed of CURL for youtube downloading

Discussion in 'PHP' started by trecords, Dec 2, 2011.

  1. #1
    Hi,

    I am trying to use wget youtube video downloading insteed of CURL but can`t get luck and i am not sure why :(
    Youtube video download link is:
    http://o-o.preferred.delta-gyd1.v3.lscache1.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Csource%2Calgorithm%2Cburst%2Cfactor%2Ccp&fexp=912206%2C910017%2C913601&algorithm=throttle-factor&itag=34&ip=93.0.0.0&burst=40&sver=3&signature=44D7708A2C5A655F5B52C7CBDBE41BA86A7614CF.35B0FBD4C867E34D8E418934D65201DB615AE5A3&source=youtube&expire=1322839095&key=yt1&ipbits=8&factor=1.25&cp=U0hRR1hOV19OT0NOMV9QSEFBOnBhV25Rb1ZoN2No&id=8381aa4956df3469
    Code (markup):
    My corking CURL cope is:
    		$ch = curl_init();
    		curl_setopt($ch, CURLOPT_URL, $ytubeurl);
    		$fp = fopen($filename, 'w');
    		curl_setopt($ch, CURLOPT_FILE, $fp);
    		curl_exec ($ch);
    		curl_close ($ch);
    		fclose($fp);
    PHP:
    And my new wget not working code is:
    echo system("wget $ytubeurl -O $filename");
    PHP:
    Let me know what do youtube uses to prevent direct downloading by wget, I am thinking on youtube uses session downloading not sure.
     
    trecords, Dec 2, 2011 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    I'd test 2 things...

    - Can you use wget directly via the command line. i.e. ssh?
    - Does your wget call within php work for other sites?
     
    mfscripts, Dec 2, 2011 IP
  3. trecords

    trecords Well-Known Member

    Messages:
    145
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #3
    it is part of script, it is on php I can`t use SSH here.
     
    trecords, Dec 2, 2011 IP
  4. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #4
    I'm on about to test. If you can run the same wget directly via the command line (and get the file) then it's an issue with the php code rather than wget on youtube. Trying to eliminate all possible causes before assuming it's as a result of youtube blocking it.
     
    mfscripts, Dec 2, 2011 IP
  5. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #5
    You url doesn't work in a browser either....

    "HTTP Error 403 (Forbidden): The server refused to fulfill the request."

    Do you need to supply authentication info?
     
    mfscripts, Dec 2, 2011 IP