Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Problems with youtubeservice

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1817 Views
  • nomen
    Avatar
    Community Member
    52 Posts

    Problems with youtubeservice Link to this post

    Hi all:

    I have installed PHP 5.1.6.
    I´m trying to include in a web page some youtube videos.
    I´m using

    $videos = $youtube->getVideosUploadedByUser('myUsername');

    In the function getVideosFeed, in this code

    $mediaentry = $entry->children('media', true);

    I get the next error

    SimpleXMLElement::children() expects at most 1 parameter, 2 given

    Because in PHP 5.1.6 children only supports one parameter. So i decide to call in this way

    $mediaentry = $entry->children('media');

    Now i have no errors, but $mediaentry is empty.
    What i´m doing bad?

    Thanks in advance and excuse me for my poor english

  • SirSpammenot
    Avatar
    Community Member
    9 Posts

    Re: Problems with youtubeservice Link to this post

    I am having a similar problem.
    openSuSE v10.2 = PHP 5.2.5, Apache 2.2.3, MySQL 5.0.26

    Initially I got a divide by zero error because max_results was always empty at line 85 in YouTubeService.php

    //get total number of videos
    $this->videoCount = $this->searchValue($conn, 'openSearch:totalResults');
    $this->pageCount = (int)($this->videoCount / $max_results);

    So if I hard code pageCount to be two pages:

    // $this->pageCount = (int)($this->videoCount / $max_results);
    $this->pageCount = 2;

    (my search term is juko-kai) Youtube returns 15 results, but the page is basically blank. The footer works, it has two page pagination links that seem to work. But the space between 'Juko-kai on Youtube' and the red page numbers in boxes is blank.

    My $media entry seems to be empty also. Working on it...
    JF

  • nomen
    Avatar
    Community Member
    52 Posts

    Re: Problems with youtubeservice Link to this post

    Hi SirSpammenot:

    I finally decide to use Zend GData api .
    I do it in this way:
    Include the link to install directory in _config.php


    $path = Director::baseFolder().'/ZendGdata-1.0.3/library/';
    set_include_path(get_include_path() . PATH_SEPARATOR . $path);

    and use it form the code:


    Zend_Loader::loadClass('Zend_Gdata_YouTube');       
    $yt = new Zend_Gdata_YouTube();
    ...

    as you can see in Developer´s guide

    bye...

    1817 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.