As the heading says, I'm getting: Fatal error: Call to a member function attributes() on a non-object in FeedsYoutubeParser.inc on line 304, when trying to import the feeds. The import works with the Common syndication parser, but not when I switch to youtube parser. This is the first time I'm working with feeds so there might be something obvious I'm missing. I tried to only import the title to see if the embedded media field is causing trouble, but even just the title wont work.

Comments

wojtha’s picture

Component: Documentation » Code
Category: support » bug

Please, could you post us the URL of the feed which are you trying to parse? Thanks

But this is a bug anyway, maybe we didn't consider all possible types of youtube feeds and also we didn't implemented any validation, that you are trying parse wrong feed yet... and we should.

Toxid’s picture

Component: Code » Documentation
Category: bug » feature
Status: Active » Fixed

I got it right now, the problem was that the url I provided was wrong. First I used the url when I had selected Query, but when I used the Get option I got the right url. For those who are having the same trouble, you need to retrieve the right url from this page Youtube API demo.

The feature I'd like to request is that the error message should say that the url is wrong, and perhaps notify the user that he or she needs to go to youtubes API demo to get the right url.

Toxid’s picture

Component: Documentation » Code
Category: feature » bug
Status: Fixed » Active

Sorry wojtha, I didn't see your post before I submitted mine. Changing it back to bug.

wojtha’s picture

Title: Fatal error: Call to a member function attributes() on a non-object » Fatal error: Call to a member function attributes() on a non-object when unsupported type of feed is provided

@Toxid: We have already link to this tool in the project description, I'm going to place it to the top, to make it more visible.

Currently this module supports Programmatic access projection for YouTube feeds. See the YouTube API index. Supports both types of possible RSS feeds: Atom or RSS2.0.

lelizondo’s picture

Can anyone please post a working feed URL, I keep getting this error and I'm using the Interactive YouTube API Demo

Edit: I'm using this URL and it's not working:

http://gdata.youtube.com/feeds/base/videos?alt=rss&q=drupal&orderby=published&format=5
Toxid’s picture

In the youtube api demo, you'll see a lot of options. If you chose one of the Get options under "Saving and collecting videos", you'll probably get it right.

lelizondo’s picture

thanks, I'll try it

ezfranca’s picture

Same Error here .. and here is my URL:

http://gdata.youtube.com/feeds/base/videos?max-results=5&alt=rss&orderby=published&author=NBAHiighlights

ezfranca’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev

and same error with another URL:

http://gdata.youtube.com/feeds/base/users/NBA/uploads?alt=rss

wojtha’s picture

@ezfranca: Please, read the module instructions, you are using base URL not API url.

Try this one: http://gdata.youtube.com/feeds/api/videos?author=NBA

ezfranca’s picture

Ok, I read it and try it with another URL: http://gdata.youtube.com/feeds/api/users/NBA/uploads?alt=rss

Now, I have the description, but I still do not have the video. I want the each feed entry with the embedded video and not only the text part with a link to youtube. There is a way to do this ? Thank you in advance.

wojtha’s picture

@ezfranca You need the Media field http://drupal.org/project/media for Drupal 7 or http://drupal.org/project/emfield for Drupal 6.

good_man’s picture

There should be an exception handler to display more friendly message + *document* how to use it in README file.

Mozzy’s picture

I am having the same problem and also tried this url: http://gdata.youtube.com/feeds/api/videos?author=NBA
Still no luck

wojtha’s picture

#13 @good_man yeah, exception handler would be nice. However we are dealing with the fatal error... anyway probably the best way how to get rid of these errors will be FeedsYoutubeHttpFetcher, which could validate the URL and prevents to run the parser if the URL will not match against supported pattern, because parser gets only raw data from Feeds and it doesn't have access to the URL from which the data was fetched. Or aternatively we need to develop some fingerprinting methods to detect with what type of feed we are dealing with before we start to parse it.

#14 @Mozzy 7.x-2.x-dev should be working now for this URL.

liberatr’s picture

What configuration is being used here?

Like what kind of a field, which Widget is applied to the field, and then how is that mapped in the "Mapping" area of the parser? I can get the video description, but that is all. The "api"-style link has really helped, but the video itself is still elusive.

EDIT: see this post http://drupal.org/node/1358558

cangeceiro’s picture

I to ran into this error. Updating the feed url changed the error, but didnt fix the problem. Note: running the latest Feeds -dev branch. So i went from the above stated error message. Switched the feed to http://gdata.youtube.com/feeds/api/videos?author=IMAItsMyArt and now i get the following error message

Service unavailable (with message) ResponseText: Recoverable fatal error: Argument 2 passed to FeedsProcessor::process() must be an instance of FeedsParserResult, null given, called in /var/www/artbabble/drupal/sites/all/modules/feeds/includes/FeedsSource.inc on line 357 and defined in FeedsProcessor->process() (line 105 of /var/www/artbabble/drupal/sites/all/modules/feeds/plugins/FeedsProcessor.inc).

alexrayu’s picture

The URL that worked for me was:

http://gdata.youtube.com/feeds/api/videos?author=NBA&alt=rss

But it filled no media youtube fields, just copied the titles.

acrollet’s picture

Status: Active » Needs review
StatusFileSize
new2.88 KB

The users I'm creating a project for will need to add individual YouTube feeds, but are not technical enough to use the YouTube API tool to locate feed URLs. (Indeed, they aren't technical enough to do more than copy and paste the page URL from a YouTube page...) So, we needed a more automatic solution. The attached patch adds a fetcher plugin that extends FeedsHTTPFetcher to correct YouTube feed URLs after they are auto-detected. If the auto-detect checkbox is not selected, the URL will not be modified in any way, so users may still choose the exact URL they need.

cangeceiro’s picture

I had a similiar need as #19 and wrote a custom solution. sharing incase someone else finds this useful

define('FEEDS_YOUTUBE_URL', 'http://gdata.youtube.com/feeds/api/videos?v=2&author=');

function artbabble_form_institution_node_form_alter(&$form, &$form_state) {
    // The feeds_youtube module requires a specific feed to work properly.  So only
    // require the user to enter the user name and we will take care of the rest.
    $form['feeds']['FeedsHTTPFetcher']['source']['#required'] = FALSE;
    $form['feeds']['FeedsHTTPFetcher']['source']['#title'] = t('YouTube Username');
    $form['feeds']['FeedsHTTPFetcher']['source']['#description'] = t('Enter institutions YouTube username');
    $form['feeds']['FeedsHTTPFetcher']['source']['#default_value'] = parse_feeds_remove_url($form['feeds']['FeedsHTTPFetcher']['source']['#default_value']);
    array_unshift($form['#validate'], 'artbabble_form_institution_node_form_validate');
}

function artbabble_form_institution_node_form_validate(&$form, &$form_state) {
    $form_state['values']['feeds']['FeedsHTTPFetcher']['source'] = parse_feeds_add_url($form_state['values']['feeds']['FeedsHTTPFetcher']['source']);
}

function parse_feeds_remove_url($url, $link = FEEDS_YOUTUBE_URL) {
    return str_replace($link, '', $url);
}

function parse_feeds_add_url($url, $link = FEEDS_YOUTUBE_URL) {
    return $link . $url;
}

gtothab’s picture

My URL works (kinda). It imports videos but the descriptions are trimmed to a max length and it only imports 25 videos max... It seems as if its hitting a paged feed that trims the descriptions (even adding elipsis) and is paged to 25 results. Any idea how to avoid this? This is the URL: http://gdata.youtube.com/feeds/api/videos?author=cangrejerossanturce&alt...

funana’s picture

Same here.

I have Youtube URLs with the exact same syntax running without any problems. One special URL throws this error.
They are all Playlist URLs

http://gdata.youtube.com/feeds/api/playlists/...