need script that retrieve info from youtube, metacafe etc.

Discussion in 'PHP' started by dracula51, Nov 17, 2009.

  1. #1
    Hello,

    can someone help me to find a script that retrieve info (title, description, tags, duration, poster name with profil url) from youtube, metacafe, veoh, redtube, pornhub & others...

    tnx :)
     
    dracula51, Nov 17, 2009 IP
  2. shubhamjain

    shubhamjain Active Member

    Messages:
    215
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #2
    Do you know RegEx and cURL?
     
    shubhamjain, Nov 17, 2009 IP
  3. dracula51

    dracula51 Peon

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    regEx...ya lil but no cUrl.
    better if u show me a lil tutorial :)
     
    dracula51, Nov 17, 2009 IP
  4. shubhamjain

    shubhamjain Active Member

    Messages:
    215
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #4
    		function cURL($url,$header,$cookie,$post_data) {
    			$ch = curl_init();
    			curl_setopt($ch, CURLOPT_HEADER, $header);
    			curl_setopt($ch, CURLOPT_NOBODY, $header);
    			curl_setopt($ch, CURLOPT_URL, $url);
    			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    			curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    			curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    			if($post_data){
    				curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    				curl_setopt($ch, CURLOPT_POST, 1);
    				curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    			};
    
    			$result = curl_exec($ch);
    			curl_close($ch);
    
    			if($result){
    				return $result;
    			}else{
    				return curl_error($ch);
    			};
    		};
    PHP:
    A function you might use. Pass appropraite values as suggested by the names of argument variables. if you want to get some data from, say google...then

    $a = cURL("http://google.com",null,null,null);
    echo $a;
    PHP:
    If you want to send some data on google then


    $a = cURL("http://google.com",null,null,"search=php");
    echo $a;
    PHP:
     
    Last edited: Nov 17, 2009
    shubhamjain, Nov 17, 2009 IP
  5. dracula51

    dracula51 Peon

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thank you very much for it :)
    i also google cUrl & learn something.

    now back to the question. "need script that retrieve info from youtube, metacafe etc"
     
    dracula51, Nov 17, 2009 IP
  6. shubhamjain

    shubhamjain Active Member

    Messages:
    215
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #6
    You have to request page through cURL as mentioned then Match your data with regExes.
     
    shubhamjain, Nov 17, 2009 IP
  7. dracula51

    dracula51 Peon

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    i already understood the theory.
    but i need just an example so i can make it without any errors

    how about giv me an example of DURATION & DESCRIPTION grabbing from a metacafe link...plz

    :)
     
    dracula51, Nov 17, 2009 IP
  8. shubhamjain

    shubhamjain Active Member

    Messages:
    215
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #8
    shubhamjain, Nov 17, 2009 IP
  9. dracula51

    dracula51 Peon

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    thank you
    it works but actually its not the best way.
    coz many server hav php curl extension disabled...like mine was
    then....in this method it loads the whole pages first (waste of time)
    the best way is to retrieve data from feed.
    example:
    for youtube: http://gdata.youtube.com/feeds/api/videos/VIDEOID
    & RegEx from there.
    i already made it for youtube but i dont know such feed link for metacafe, veoh, dailymotion, pornhub, redtube
    thats what i want now :(
     
    dracula51, Nov 17, 2009 IP