Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Wednesday, October 27, 2010

Issue with the feedapi_mapper module...

Hi,

So had a nice time with my last posts for creating embedded video feeds into your drupal instance. Most of you would have got your feeds working. If you have any issue with feed first refer this. It should work after doing the mentioned changes to simplepie parser. If it still is not working and showing you NULL values getting entered into the content type type table (say, content_type_video_item) then make the following changes to feedapi_mapper modules feedapi_mapper.api.php file which you can find in feedapi_mapper module directory.

There in the file you will find the function hook_feedapi_mapper where in the parameter of the function one of the parameters is refer as $sub_field = '' whereas in the function body it is used as $node->myfields[$subfield]. change it to $node->myfields[$sub_field]. The wrong object reference name is causing it to take a garbage value. Though original one works for most of the feeds but causes certain issue when you go for anything like video feeds where you have a embedded video field which is a custom field causing it to behave abnormally.

Your feed should work fine now. if it still is not working then make sure that you have enabled and configured the required provider module.

So enjoy you video feeds now....

Issue with the Simplepie Parser....

Hi friends,

While working with embedded feed which I discussed earlier I found an issue with the simplepie parser. Though the parser seems to be working fine with all the feeds until you want it to work on custom fields urls or with operating systems which can't support automatic decoding of urls. hence I have provided this patch over here which can make it workable on all the platforms.

In parser_simplepie.module which you can find out at contributed third party module directory under feedapi/parser_simplepie, the original_url must be decoded to the normal format.

You can find it in a function _parser_simplepie_feedapi_parse which is there in the same file and search for $curr_item->options->original_url.
 which will look something like this:
$curr_item->options->original_url = ($entity_decode && $simplepie_item->get_link()) ? html_entity_decode($simplepie_item->get_link()) : $simplepie_item->get_link();

Change it to:

$curr_item->options->original_url = ($entity_decode && urldecode($simplepie_item->get_link())) ? urldecode(html_entity_decode($simplepie_item->get_link())) : urldecode($simplepie_item->get_link());

And Thats it. It should work now on any platform...

Creating a feed of embedded videos in Drupal

Hi guys,

Its been a long time that i never had not posted over here about mu life...was a bit busy....so sorry for that... Today I ma going to share something that I learned while working with drupal to create a video feed... So here I goes.

Too create feeds of embedded third-party videos on Drupal sites using a combination of CCK, Embedded Media Field, media_youtube, FeedAPI, & the FeedAPI Element Mapper modules...

i am taking feeds from youtube hence using media_youtube. If you want use any other provider please download the required provider module from here.

  1. Enable the following modules and sub-modules: CCK, Embedded Media Field, Embedded Video Field, media_youtube, FeedAPI, FeedAPI Mapper, Common Syndication Parser or SimplePie Parser, FeedAPI Node. Make sure to give yourself the correct permissions in the access control admin page. Also refer Installation steps from the respective modules, especially feedapi module as it requires simplepie parser module as well.
  2. Create a content type (lets say video_item) that includes custom field (embedded video field). You can use FeedAPI Node's default content type, called feed, or (recommended) you can create your own (say video_feed) and designate it as a feed in the content type settings page.
  3. Under admin/settings/feedapi it is suggested that you remove object and embed tags from the allowed list, as these may cause problems with certain providers.
  4. 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.
  5. On the page of the feedapi node you created select the "Map" tab, next to "Edit" (it should take a few moments to load).
  6. 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". 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".
  7. 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!
Thats it. you are done... And now you can have a video feed in your drupal instance.