Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • HI guys,

    sorry for not getting back at you asap, i have been really busy with my work.

    I’m seeing all kind of small issues, i have just create a solution that works for me, for the rest we can solve it as we are doing it now, collaborating. I don’t really have the time to check everyone’s issues with this plugin, but i can try to help, I give you the guidance and the most important piece of code to make it work, it is not working then lets all get involved and try one another. I’m happy that my solution though helped some of you.

    @nextart I think you are right most of the values i have copied from youtube, a couple of them did changed i have noticed, certainly i forgot that one so yes try changing to the one in youtube “videoDuration” stead of “duration”. I will have to change also in my code.

    thanks.

    Can you guys Zip your cool video gallery folder, and email it to me…
    Im really curious to know what is wrong then, mine is working perfectly.

    surinology(@)gmail(DOT)COM

    What error are you getting? And can you plz post your source code here.

    Just to be sure i have made a short video adding the API, i was doing all correct also but it was not going at the first 3 attempts cause i haven’t selected the right project on the Google Console Dashboard, I was giving permission to the YouTube API on another project. Just check this video.

    Cool Video Gallery: Generating & Adding YouTube API Key v3

    Hi guys,

    This plugin is using the YouTube Data API (v2) not supported anymore since april 2015.

    I have faced the same problem. This issue really bothered me so much that stead of downloading another plugin i have DECIDED to try fixing it or DIE! It took me 2 days to figure it out how YouTube Data API (v3) and How Cool Video Gallery works.

    I have re-build the whole CVGYoutubeAPI class
    to be able to work with YouTube Data API (v3).

    1. Open: /wp-content/plugins/cool-video-gallery/lib/youtube.php
    2. Replace the whole class CVGYoutubeAPI {} with the one below
    <?php
    /**
     * Helper Class for Youtube API
     *
     * @author - Praveen Rajan
     */
    class CVGYoutubeAPI {
    
    	/**
    	 * Initializes values
    	 * @author Praveen Rajan
    	 */
    	function CVGYoutubeAPI() {
    
    	}
    
    	/**
    	 * Returns Youtube video ID
    	 * @author Praveen Rajan
    	 */
    	function getPatternFromUrl($url) {
    
    		$url = $url . '&';
    		$pattern = '/v=(.+?)&+/';
    		preg_match($pattern, $url, $matches);
    
    		return ($matches[1]);
    	}
    
    	/**
    	 * Parses Youtube video to get details of video
    	 * @author Praveen Rajan
    	 */
    	function parseVideoEntry($entry) {
    		$obj = new stdClass;
    
    		// get nodes in media: namespace for media information
    		$media = $entry ;
    		$obj -> title = $media -> {'items'}[0]->{'snippet'}->{'title'};
    		$obj -> description = $media -> {'items'}[0] -> {'snippet'} -> {'description'};
    
    		// get video player URL
    		$obj -> watchURL = 'https://www.youtube.com/watch?v=' . $media -> {'items'}[0] -> {'id'};
    
    		// get video thumbnail
    		$obj -> thumbnailURL = $media -> {'items'}[0] -> {'snippet'} -> {'thumbnails'} -> {'default'} -> {'url'};
    
    		// get <yt:duration> node for video length
    		$obj -> length = $media -> {'items'}[0] -> {'contentDetails'} -> {'duration'};
    
    		// get <yt:stats> node for viewer statistics
    		$obj -> viewCount = $media -> {'items'}[0] -> {'statistics'} -> {'viewCount'};
    
    		// get <gd:rating> node for video ratings
    		$gd = $media -> {'items'}[0] -> {'statistics'} -> {'likeCount'};
    		if ( $gd > 0 ) {
    			$obj -> rating = $media -> {'items'}[0] -> {'statistics'} -> {'likeCount'};
    		} else {
    			$obj -> rating = 0;
    		}
    
    		// get <gd:comments> node for video comments
    			$obj -> commentsURL = 'https://www.youtube.com/watch?v=' . $media -> {'items'}[0] -> {'id'};
    			$obj -> commentsCount = $media -> {'items'}[0] -> {'statistics'} -> {'commentCount'};
    
    		// get feed URL for video responses
    			$obj -> responsesURL = 'https://www.youtube.com/watch?v=' . $media -> {'items'}[0] -> {'id'};
    
    		// get feed URL for related videos
    			$obj -> relatedURL = '';
    
    		// return object to caller
    		return $obj;
    	}
    
    	/**
    	 * Returns Youtube video details
    	 * @author Praveen Rajan
    	 */
    	function youtube_video_details($vid) {        
    
        $key_id='YOUR_GOOGLE_API_KEY';
        $url = "https://www.googleapis.com/youtube/v3/videos?part=snippet&key=". $key_id ."&id=". $vid;
    
    		// set JSON video data fetching URL
    		$feedURL = 'https://gdata.youtube.com/feeds/api/videos/' . $vid;
    
    		$entry = json_decode(file_get_contents($url,0,null,null),false);
    
    		// parse video entry
    		$video = $this -> parseVideoEntry($entry);
    
    			return $video;
    
    	}
    }
    ?>

    To make it work you need to create a API key
    Public API access Key => Key for server applications
    Then at your google dashboard give permission to Youtube.

    Go here: https://console.developers.google.com/ to create a new api key and give permission to youtube.

    karamurad:

    I had the exact same problem I did what jomsky said, worked perfectly.
    and i’ve replaced the latest cformslib_email.php with cforms2.14.0 lib_email.php

    1)Replace class name cf_mail {…
    WITH cforms2_mail {…

    2)upload it /httpdocs/wp-content/plugins/cforms2 ??

Viewing 5 replies - 1 through 5 (of 5 total)