Clipshare youtube grabber

Discuss of clipshare script, custom programming, templates or anything related to this video script

Clipshare youtube grabber

Postby dargre » Thu Jul 21, 2011 9:40 pm

From some time Youtube sarted with new short URL for their videos.
It looks like: http://youtu.be/wPbK9PkSjWI
If you have clipshare grabber, such URL will not work....
However it's easy to set support for such new yt URL.

You should have a file "classes/youtube.class.php", and inside a function:
Code: Select all
    function getVideoID()
    {
        $position       = strpos($this->youtube_url, 'watch?v=')+8;
        $remove_length  = strlen($this->youtube_url)-$position;
        $video_id       = substr($this->youtube_url, -$remove_length, 11);
        return $video_id;
    }


Replace this function with new one:
Code: Select all
    function getVideoID()
    {
        if(strpos($this->youtube_url,'youtu.be')) {
           $position = strpos($this->youtube_url, 'youtu.be/')+9;
        } else {
           $position       = strpos($this->youtube_url, 'watch?v=')+8;
        }
        $remove_length  = strlen($this->youtube_url)-$position;
        $video_id       = substr($this->youtube_url, -$remove_length, 11);
        return $video_id;
    }


Now grabber will be able to extract youtube id form both: default and new short URL.
Thank you,
Nuevolab Team
dargre
 
Posts: 331
Joined: Mon Sep 07, 2009 3:47 am

Return to Clipshare

Who is online

Users browsing this forum: No registered users and 0 guests

cron