Git Product home page Git Product logo

codeigniter-youtube-data-video-api-library's Introduction

CodeIgniter YouTube Data Video API Library

Esta libreria ayuda a obtener la información de un video YouTube en específico

NOTA:

Se utiliza la API 2.0 de Youtube. --> > https://developers.google.com/youtube/2.0/reference

Definición de los elementos XML (Media RSS, Esquema XML de YouTube, Esquema de Google Data) --> https://developers.google.com/youtube/2.0/reference#API_Request_XML_Element_Definitions

Modo de uso

Copia el archivo en la carpeta de librerias de tu aplicacion - "./application/libraries/""

Invocar la clase

	$this->load->library('youtube_video');
	$this->youtube_video->youtube_data($youtube_url);

Donde $youtube_url puede ser de las siguientes formas:

Si la url es inválida o el ID no existe (incorrecto o eliminado) retorna un valor null

Valores de retorno

$youtube_data['youtube_id'] 		//Id del video
$youtube_data['title'] 	//titulo del video
$youtube_data['author']['name'] 		//nombre del autor
$youtube_data['author']['uri'] 		//(Url Autor (perfi))
$youtube_data['category'] 		//categoría asignada
$youtube_data['published'] 		//(fecha de publicación)
$youtube_data['updated'] 		//(fecha actualizado)
$youtube_data['keywords'] 		
$youtube_data['statistics']['favoriteCount'] 		//(indica el número de usuarios que han añadido un vídeo a su lista de favoritos.) (si no existe regresa null)
$youtube_data['statistics']['viewCount'] 		//Numero de veces visto (si no existe regresa null)
$youtube_data['duration'] 		//(duración en segundos)
$youtube_data['duration_format'] 		//(duración en h:m:s)
$youtube_data['description'] 		//(regresa null si no hay)
$youtube_data['rating']['average'] 		//(YouTube utiliza un sistema de puntuación de 1 a 5 en el que 1 es la puntuación más baja y 5 la mas alta.)
$youtube_data['rating']['numRaters'] 		//(Cantidad de votantes)

--- imagenes url ---
$youtube_data['0_thumbnail']['url']
$youtube_data['1_thumbnail']['url']
$youtube_data['2_thumbnail']['url']
$youtube_data['3_thumbnail']['url']

--- imagenes height ---
$youtube_data['0_thumbnail']['height']
$youtube_data['1_thumbnail']['height']
$youtube_data['2_thumbnail']['height']
$youtube_data['3_thumbnail']['height']

--- imagenes width ---
$youtube_data['0_thumbnail']['width']
$youtube_data['1_thumbnail']['width']
$youtube_data['2_thumbnail']['width']
$youtube_data['3_thumbnail']['width']

--- imagenes tiempo de captura ---
$youtube_data['0_thumbnail']['time']
$youtube_data['1_thumbnail']['time']
$youtube_data['2_thumbnail']['time']
$youtube_data['3_thumbnail']['time']

Ejemplo de uso

load->library('youtube_video');
if($youtube_data = $this->youtube_video->youtube_data($youtube_url)) {
	echo 'ID: '.$youtube_data['youtube_id'].'
'; echo 'Titulo: '.$youtube_data['title'].'
'; echo 'Autor: '.$youtube_data['author']['name'].'
'; echo 'Url Autor (perfi): '.$youtube_data['author']['uri'].'
'; } else { echo 'Upss!! El video no existe - Revisa tu URL ¯\(°_o)/¯'; } ?>

NOTA Para obtener solo el ID del video sin llamar a la API:

	$youtube_url = 'http://www.youtube.com/watch?v=U6Vf4zZiKAA';
	$this->load->library('youtube_video');
	echo $this->youtube_video->youtube_id($youtube_url);

Licencia

Copyright © 2013 - @PhiRequiem
GNU -> http://www.gnu.org/licenses/gpl.txt

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

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.