Module Mashup: Creating a feed of embedded videos using emfield, feedapi, and feedapi_mapper
Posted April 14th, 2008 by Alex UA
The following is a HOWTO I just submitted to the Drupal.org Handbook
It is now easy to create feeds of embedded third-party videos on Drupal sites using a combination of CCK, Embedded Media Field, FeedAPI, & the FeedAPI Element Mapper modules.
- Enable the following modules and sub-modules: CCK, Embedded Media Field, Embedded Video Field, FeedAPI, FeedAPI Mapper, Common Syndication Parser or SimplePie Parser, FeedAPI Node, & (if you plan on using views with your feeds) FeedAPI Node Views. Make sure to give yourself the correct permissions in the access control admin page.
- Create a content type that includes an embedded video field. Once you add the field in is suggested that you select "thumbnail" or "thumbnail with thickbox" to avoid loading too many videos on pages with teaser lists. You can use FeedAPI Node's default content type, called feed, or you can create your own and designate it as a feed in the content type settings page.
- Under admin/settings/feedapi it is suggested that you remove
- Create a feed at node/add/feedapi-node (if you are using the default feedapi node). Give the feed a name, you can leave body blank (the field will fill this by default), and enter in the address of the field in the "feed" field. Make sure that "Refresh feed on creation" is unchecked, then click on "Processors". In thedrop-down menu under "Node type of feed items:" select the content type for embedded videos that you created in step 2, then submit the node.
- On the page of the feedapi node you created select the "Map" tab, next to "Edit" (it should take a few moments to load).
- On the mapping page expand the form item labled "Feed item example" and look for the original URL of the example video (i.e. the url as you would normally paste it into an embedded video field); for most video providers this will be "options->original_url", though Google Videos currently maps to "options->raw->guid". Under "Edit mapping" find the item that matches the url and select to map it to the embedded video field (you can also map items to taxonomies or other fields if you like and have it set up). Press "Update".
- After you are redirected back to the feedapi node click on "Refresh", which should populate your feed. Click on "Feed Items", and you should now see a feed of videos!
Notes:
- in order to use the thickbox thumbnails you must also use the thickbox module and patch it as described here.
- this method creates nodes from the feed items, so please keep in mind that this could create a good deal of nodes on your site in a short amount of time.















YouTube Playlists
Any idea how to get a YouTube playlist as a feed?
Would be great to be able to automatically create nodes for videos that have been added to a playlist.
Hack it
YouTube doesn't really provide much information on how to do this, but if you take a look around the web there are quite a few free services that purport to give you rss feeds from playlists.
Check it out: http://www.google.com/search?q=youtube+playlist+rss
What's the advantage?
Forgive my ignorance, but what is the advantage of doing it this way, setting up a separate field for the video, when FeedAPI can already bring in all the html of each feed item, videos included, into the generated node? Is it to give you more flexibility with layout templating? Are there other advantages?
Views + CCK = Cool Stuff
The real benefit is that you can then use the power of views and CCK/emfield to do a lot more with the feeds than just display a list of videos, by virtue of being able to stick various elements into their own fields. For example, I don't think that the video page I made (you can see it via the navigation menu) would be possible without turning the feed items into nodes, since that page has a list of thumbnails and a wrapper that allows for thickbox to work (I could be wrong, but I'd be curious to see how that would work). I'm really not even sure if you'd be able to theme or resize the videos automatically if it was within a feed, let alone force it to give you a thumbnail only on the display page (and I don't think it's a great idea to load a bunch of different videos from a bunch of different providers at one time on the same page).
So I guess the answer is: it's only useful if you need the extra functions you get from using cck fields and views.
I've just written this how-to for an admin
Just talked an admin how to set up feeds with a similar set up to the above and noted them here: http://wiki.transmission.cc/index.php/Step_by_Step_Guide_to_Adding_a_Fee...
Obviously they will need editing for your own fields and so on. And there will always be exceptions, but it might help you get started writing help for your own sites.
Autoplay
This is working brilliantly for me, the walk through is clear and easy to follow so a BIG thanks!
Only questions I still have is why my youtube videos won't autoplay?
Open an issue.
Autoplay should be supported when using emfield and youtube- can you create an issue in the emfield queue?
White screen on refresh
Although I did manage to make this work, on recent installs I simply get a white screen on refresh of feeds and am unable to draw the feed... Any ideas what I am missing?
PHP Memory?
That usually indicates that PHP is timing out. What happens if you let it run on cron?
iTunes?
Hi -
Does this method work with iTunes, for video podcasts?
TIA!
Currently, no...
At the moment there is not an iTunes provider file for emfiled, but if someone makes one this would definitely be possible.
Post new comment