Пример #1
0
 /**
  * Muestra los videos del canal seleccionado
  * @param $id
  * @return \Illuminate\View\View
  */
 public function index($id)
 {
     $youtube = new \Madcoda\Youtube(array('key' => 'AIzaSyC4DkOm379a_5p77mjjLlEsBubtPXYO584'));
     $video = ChannelVideos::where('channel_id', '=', $id)->Where('viewed', '=', 0)->first();
     if ($video != null) {
         $info = $youtube->getVideoInfo($video->url);
         $time = $this->timeCalculate($info->contentDetails->duration);
         $this->viewedUpdate($video->id);
     }
     return view("youparty.show", compact('video', 'time'));
 }
 public function search()
 {
     $word = (string) Input::get('artist');
     if (isset($word)) {
         $youtube = new \Madcoda\Youtube(array('key' => 'AIzaSyDKLmH2_s3qJUGBWATDh880Hahw_3rh_UE'));
         $allVideos = $youtube->searchVideos($word);
         $videoId = $allVideos[0]->id->videoId;
         if (!empty($videoId)) {
             $videos = $youtube->getVideoInfo($videoId);
             return response()->json($videos);
         } else {
             response()->json(['status' => 'no video']);
         }
     } else {
         response()->json(['status' => 'no artist']);
     }
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $youtube = new \Madcoda\Youtube(array('key' => 'AIzaSyC4DkOm379a_5p77mjjLlEsBubtPXYO584'));
     $videoId = $youtube->parseVIdFromURL('https://www.youtube.com/watch?v=OsjdYQJc748&list=PLPKuYmN_zBQnhH3CNtt3ESwlDP7gWb7WU&index=1');
     dd($youtube->getVideoInfo($videoId));
 }