Feed Import Youtube using media_youtube module.

Last updated on
30 April 2025

Feed Import is a module that allows you to import content into entities from various file types (like XML, HTML, CSV).
In this page we will import some youtube videos and for media we will use media_youtube module.

Create content type

We have to create a new content type (admin/structure/types/add) named "Youtube videos" (with machine name youtube_videos).
Attach to this a new field "field_youtube" with type of "Multimedia asset".
(You can add another fields to hold author, views, ...)
Save your content type.

Feed Import Youtube Content Type

After I've added a new content I didn't see video player anywhere. In this issue I found some help but still video player appears only on front page if node is promoted. Please take a look if you have similar problems.

Create Feed Configuration

We will use an RSS feed to get most recent videos (this link might change): http://gdata.youtube.com/feeds/api/videos?alt=rss.
If you want you can get another one here.

Ok, now go to Feed Import and add new feed named "Youtube import", for entity select "node", for url set our feed url and for process function select "processXML".

Feed Import Youtube New Feed

Go and edit this feed.
For xpath parent use //item and don't use anything for xpath unique because this is a one time import to see how to work with media_youtube.
Now add the following fields:
title with xpath title with action if empty: "Skip importing this item"
field_youtube with xpath link
type with no xpath and default value set to youtube_videos (machine name for our content type, without this we cannot save a node)
promote with no xpath with default value set to 1 (we promote this on front page)
uid with no xpath and default value set to 1 (we set as author the admin).
Now save the feed and it's time to go to filters.
For field_youtube add the following filters (don't use quotes):
"Get media provider" with function name "media_internet_get_provider" and one param: [field]
"Save video" with function name "::callMethod" and two params: [field] and save
Feed Import Youtube Filters
Save filters and go to process your feed. You should see on front page imported videos.
In reports you should find something like

Feed Youtube import imported. Started 08/12/2011 20:30:56, file downloaded & parsed 00:00:03, processing items 00:00:02, total duration 00:00:05, total feed items 25, rescheduled 0, updated 0, new 25, not imported 0.

Help improve this page

Page status: Not set

You can: