Giter VIP home page Giter VIP logo

youtube-data-api-codeignitor's Introduction

YouTube Data API v3 CodeIgniter library for uploading a video

A YouTube API 3 Library for uploading a video to youtube for CodeIgniter PHP Framework (3.x).Upload videos to youtube using codeignitor is very simple using this library.

Usage:

  • Change client auth id secret and Authorized redirect URI in application/config/Google.php and copy in the appropriate directory in your project.
  • Add videos folder(which contains a sample video for testing purpose) outside application folder ,i.e. in you root directory.
  • Add google-api-php-client folder and Google_client_api.php in application/libraries folder in your project.
  • A sample controller welcome.php contains an example to call the custom library Google_client_api.Path is application/controllers.

Compatibility:

The library has been tested successfully with the below mentioned environment:

Requirements:

  • Codeignitor Framework >= 2.x

Installation:

The most common flow is:

  1. add Google.php in application/config folder in you rproject and change accordingly.
  2. add google-api-php-client folder and Google_client_api.php in application/libraries folder in your project.
  3. Modify default controller Welcome.php with the given controller in application/controllers folder in your project.
  4. get client id,client secret and redirect uri from https://console.developers.google.com Simple example:
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	class Welcome extends CI_Controller {

		/**
		 * Index Page for this controller.
		 *
		 * Maps to the following URL
		 * 		http://example.com/index.php/welcome
		 *	- or -  
		 * 		http://example.com/index.php/welcome/index
		 *	- or -
		 * Since this controller is set as the default controller in 
		 * config/routes.php, it's displayed at http://example.com/
		 *
		 * So any other public methods not prefixed with an underscore will
		 * map to /index.php/welcome/<method_name>
		 * @see http://codeigniter.com/user_guide/general/urls.html
		 */
		public function index()
		{
			$this->load->view('welcome_message');
		}
		
		public function youtube() {
			
			$this->load->library('google_client_api');
			$video= "sample.mp4";//video file which is in videos folder (this should be outside application folder)
			$title= "your custom title for youtube video v3"; //your title for youtube video
			$desc= "your custom youtube video description"; //your description for youtube video
			$tags=["rahultvn","youtubeapi3"]; //your custom tags for youtube video
			$privacy_status="public"; //video status public or private
			$youtube=$this->google_client_api->youtube_upload($video,$title,$desc,$tags,$privacy_status);
			print_r($youtube);
			//echo "hi";	
		}
		
	}

	/* End of file welcome.php */
	/* Location: ./application/controllers/welcome.php */

License

This library is licensed under the MIT license.

Author

Testing

youtube-data-api-codeignitor's People

Contributors

rahul455 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.