feedMeta = StructNew(); feedMeta.ServiceType = "youtube"; feedMeta.ServiceLink = "http://www.youtube.com/"; feedMeta.ServiceLogo = "/ADF/apps/pt_social_media/images/youtube-32.png"; // TODO: Get from config element return feedMeta; var objHttp = StructNew(); var feedError = false; var feedErrorDetails = StructNew(); if ( feedError ) { objHttp['feedError'] = feedError; objHttp['errorDetails'] = feedErrorDetails; objHttp['statusCode'] = "cfhttp error"; objHttp['feedURL'] = arguments.feedURL; //Log the Error doErrorLogging("youtube","getYouTubeHTTPrequest",objHttp); } return objHttp; var reData = StructNew(); var objHttp = getYouTubeHTTPrequest(TRIM(arguments.feedURL)); // Convert the objHttp.fileContent to JSON if possible if ( IsStruct(objHttp) AND StructKeyExists(objHttp,"Statuscode") AND Find("200",objHttp.Statuscode) ) { if ( StructKeyExists(objHttp,"Filecontent") AND IsJSON(objHttp.Filecontent) ) { reData = deserializejson(objHttp.Filecontent); reData['statuscode'] = objHttp.statuscode; } else { reData['feedError'] = "fail: JSON not Returned"; reData['feedURL'] = arguments.feedURL; reData['statuscode'] = objHttp.statuscode; if ( StructKeyExists(objHttp,"Filecontent") ) reData['fileContent'] = objHttp.Filecontent; } } else { reData['feedError'] = "fail: connection error"; reData['feedURL'] = arguments.feedURL; if ( StructKeyExists(objHttp,"statuscode") ) reData['statuscode'] = objHttp.statuscode; if ( StructKeyExists(objHttp,"Filecontent") ) reData['fileContent'] = objHttp.Filecontent; } // Log the Error if reData contains a feedError Key if ( StructKeyExists(reData,"feedError") ) { //Log the Error doErrorLogging("youtube","getYouTubeFeed",reData); } return reData; var feedData = StructNew(); var reData = ""; //StructNew() var appConfigStruct = getAppConfig(); var feedURL = ""; var apiURL = ""; var objHttp = StructNew(); var uName = TRIM(arguments.userName); var replaceStr = "{{username}}"; // Default: http://gdata.youtube.com/feeds/api/users/thesunypotsdam?v=2&alt=json if ( StructKeyExists(appConfigStruct,"apiYouTubeChannel") ) { apiURL = appConfigStruct.apiYouTubeChannel; // Use the user Name in the API URL //application.ptSocialMedia.utils.doDUMP(apiURL,"apiURL"); //fix any character encoding from storing API URLs in the config element apiURL = Server.CommonSpot.UDF.data.FromHTML(apiURL); //apiURL = server.commonspot.udf.html.unescape(apiURL); //application.ptSocialMedia.utils.doDUMP(apiURL,"apiURL"); } // Replace the {{username}} with the passed in user name if ( Len(Trim(uName)) AND Len(Trim(apiURL)) ) { if ( FindNoCase(replaceStr,apiURL) ) feedURL = ReplaceNoCase(apiURL,replaceStr,uName,"one"); //application.ptSocialMedia.utils.doDUMP(feedURL,"feedURL"); // Get the Feed Data if ( LEN(TRIM(feedURL)) ) { feedData = getYouTubeFeed(TRIM(feedURL)); //application.ptSocialMedia.utils.doDUMP(feedData,"feedData"); if ( StructKeyExists(feedData,"entry") ) { reData = feedData.entry; } else { // Log the error doErrorLogging("youtube","getYouTubeChannel",feedData); reData = StructNew(); } } } // Log the error if reData is not returning the expected data types if ( !IsStruct(reData) ) { doErrorLogging("youtube","getYouTubeChannel",reData); reData = StructNew(); } return reData; var feedData = StructNew(); var reData = ""; //ArrayNew(1) var appConfigStruct = getAppConfig(); var feedURL = ""; var apiURL = ""; var objHttp = StructNew(); var uName = TRIM(arguments.userName); var replaceStr = "{{username}}"; var postQtyParamStr = "&max-results="; // Default: http://gdata.youtube.com/feeds/api/users/thesunypotsdam/uploads?v=2&alt=json if ( StructKeyExists(appConfigStruct,"apiYouTubeChannelUploads") ) { apiURL = appConfigStruct.apiYouTubeChannelUploads; // Use the user Name in the API URL //fix any character encoding from storing URLs in the config element apiURL = Server.CommonSpot.UDF.data.FromHTML(apiURL); } // Replace the {{username}} with the passed in user name if ( Len(Trim(uName)) AND Len(Trim(apiURL)) ) { if ( FindNoCase(replaceStr,apiURL) ) feedURL = ReplaceNoCase(apiURL,replaceStr,uName,"one"); //application.ptSocialMedia.utils.doDUMP(feedURL,"feedURL"); // Get the Feed Data if ( LEN(TRIM(feedURL)) ) { // if Max Post is passed add the "max-results" parameter and maxPosts value to the feedURL if ( LEN(TRIM(arguments.maxPosts)) AND IsNumeric(arguments.maxPosts) ) feedURL = feedURL & postQtyParamStr & arguments.maxPosts; //application.ptSocialMedia.utils.doDUMP(feedURL,"feedURL"); feedData = getYouTubeFeed(TRIM(feedURL)); if ( StructKeyExists(feedData,"feed") AND StructKeyExists(feedData.feed,"entry") AND IsArray(feedData.feed.entry) AND ArrayLen(feedData.feed.entry) ) { reData = feedData.feed.entry; } else { // Log the error doErrorLogging("youtube","getYouTubeChannelUploads",feedData); reData = ArrayNew(1); } } } // Log the error if reData is not returning the expected data types if ( !IsArray(reData) ) { doErrorLogging("youtube","getYouTubeChannelUploads",reData); reData = ArrayNew(1); } return reData;