I've "formally" released the new version of my YouTube CFC to it's RIAForge home. This new version doesn't have a one to one relation to the older API so I've included the old code in the zip as well. Right now it supports:
- Various 'top' video feeds (most popular, etc)
- Videos by category, keyword, or both
- Videos by user
- Comments for a video
- Playlists for a user
- Videos for a playlist
And of course the big one - video upload.
The major things left to do include posting new comments and updating video information. Hopefully I can get the YouTube API Blog folks to notice.
Comment 1 written by Bob on 19 April 2008, at 11:00 PM
Regardless, this is really helpful - thank you!
Comment 2 written by Geoff on 20 April 2008, at 6:40 AM
I'm always concerned about timeouts / problems connecting to third party services - how would getVideos() tell the calling app "sorry, I couldn't contact the youtube website"
Could (should?) you change getVideos() to return a struct - one key has the results recordset, and one key has a "statuscode" message maybe?
Then put a timeout on the cfhttp call, and try/catch it?
just a thought...
Comment 3 written by Raymond Camden on 20 April 2008, at 8:42 AM
Comment 4 written by Raymond Camden on 20 April 2008, at 8:45 AM
Comment 5 written by Bob on 20 April 2008, at 9:35 AM
Comment 6 written by Raymond Camden on 20 April 2008, at 6:10 PM
Comment 7 written by Bob on 20 April 2008, at 9:19 PM
Comment 8 written by Raymond Camden on 21 April 2008, at 8:28 AM
So I will add this later today.
Comment 9 written by jason on 23 June 2008, at 11:06 PM
trying the test2.cfm file in the youtubeapi1 folder and keep getting "Bad, unknown, or disabled dev_id specified."
i want to test the upload function and can't get started.
the cfc is installed and i have a valid dev key.
any advice or other documentation? where to start with uploads?
thanks!
Comment 10 written by Raymond Camden on 24 June 2008, at 2:50 AM
Comment 11 written by Louis Plante on 22 September 2008, at 7:03 PM
<cfset yt = createObject("component", "assets.cfcs.youtube")>
<cfset pl = yt.getVideosByUser('marjenningstv')>
any suggestions?
Comment 12 written by Raymond Camden on 22 September 2008, at 7:48 PM
FYI - upload is currently broken. I hope to have it fixed w/n a week. It turns out there is a bug in CF that only gets exposed with the YT api.
Comment 13 written by Greg E. on 13 October 2008, at 5:12 PM
<cfinvoke component="youtube" method="init" returnvariable="yt"><cfinvokeargument name="devkey" value="#request.YouTubeDeveloperKey#"></cfinvoke>
<cfdump var="#yt.upload(video='#cffile.SERVERDIRECTORY#\#cffile.SERVERFILE#',title='Upload Test',description='Testing',categories='Education',keywords='YouTube ColdFusion')#">
Upload Result:
--------------
ErrorDetail: I/O Exception: Software caused connection abort: socket write error
Filecontent: Connection Failure
Mimetype: Unable to determine MIME type of file.
Statuscode: Connection Failure. Status code unavailable.
Comment 14 written by Raymond Camden on 13 October 2008, at 5:17 PM
Long story short: You can't do the upload now- period. But you will be able to with a hotfix sometime in the (I would assume!) near future.
Comment 15 written by aviva on 30 November 2008, at 4:29 PM
http://kb.adobe.com/selfservice/viewContent.do?ext...
but i get an error when trying to upload:
the error is in your cfc, trying to read an error.
can you give an example of the code needed to upload a video?
Element ERRORS.ERROR.DOMAIN.XMLTEXT is undefined in RESXML.
The error occurred in /home/mylifesp/dev_html/my-account/youtube.cfc: line 691
689 : <cfset resxml = xmlParse(result.fileContent)>
690 :
691 : <cfthrow message="YouTubeCFC Upload Error: Domain=#resxml.errors.error.domain.xmlText#, Code=#resxml.errors.error.code.xmlText#">
692 : <cfelse>
Comment 16 written by Raymond Camden on 30 November 2008, at 4:40 PM
Comment 17 written by Derek on 22 December 2008, at 9:27 AM
Both the Client ID and Developer Key should be provided in every API request (see Using a developer key and client ID). Each application/product should have its own unique Developer Key and Client ID.
http://code.google.com/apis/youtube/dashboard/prod...
Has it changed since the last update?
Comment 18 written by Raymond Camden on 22 December 2008, at 9:36 AM
Comment 19 written by Derek on 22 December 2008, at 9:37 AM
Comment 20 written by Raymond Camden on 22 December 2008, at 9:40 AM
Comment 21 written by Derek on 15 January 2009, at 8:50 AM
Everything was working at first. Then I started getting connection failures. I did some testing and by removing the V2 param, I got it working again.
So now the past couple of days it is no longer working on the prod server which is 7,0,2,142559 , but works fine on 8 from my home dev box.
Charset [empty string]
ErrorDetail Unknown host: gdata.youtube.com: gdata.youtube.com
Filecontent Connection Failure
Header [undefined struct element]
Mimetype Unable to determine MIME type of file.
Responseheader
struct [empty]
Statuscode Connection Failure. Status code unavailable.
Text YES
here is a test page I am using
http://justs10.com/videos/t.cfm
If anyone could help, be mucho appreciated.
Thanks,
D
Comment 22 written by Raymond Camden on 15 January 2009, at 9:08 AM
Comment 23 written by Lamar on 4 February 2009, at 2:16 PM
Comment 24 written by Raymond Camden on 4 February 2009, at 2:18 PM
Comment 25 written by Raymond Camden on 4 February 2009, at 2:22 PM
<cfset yt = createObject("component", "youtube")>
<cfset yt.setDeveloperKey("AI39n2n17CzpcDAt6GMrXc8z6DA")>
<cfset yt.login("cfjedimaster", "password")>
<cfset r = yt.upload(expandPath('./actual.mov'),'Test/Upload Jack-O-Latern','Playing/with Jack-O-Latern youtube aug29','Music','testing fun')>
<cfoutput>id=#r#</cfoutput>
Comment 26 written by tj on 3 September 2009, at 9:30 AM
Everything is working just as it should with the exception of the upload. I used the example upload code you supplied (altered to my id, login and video location) and I'm getting the:
Element ERRORS.ERROR.DOMAIN.XMLTEXT is undefined in RESXML.
Any thoughts?
Comment 27 written by tj on 3 September 2009, at 9:43 AM
Comment 28 written by Raymond Camden on 4 September 2009, at 4:44 PM
Comment 29 written by tj on 4 September 2009, at 7:48 PM
Thanks!
Comment 30 written by Misty on 28 September 2009, at 2:51 AM
One last question does not it return rows more than 25 either try to fetch by category or keywords:
Just curious
Comment 31 written by Raymond Camden on 28 September 2009, at 6:13 AM
Comment 32 written by Shaveta on 28 September 2009, at 10:27 AM
i am just using getplaylist, not getplaylists
is there any example to that
Comment 33 written by Raymond Camden on 28 September 2009, at 10:28 AM
Comment 34 written by Shaveta on 28 September 2009, at 9:36 PM
i just used #yt.getplaylist#
and it keeps on loading. how can i know in youtube playlists
Comment 35 written by Misty on 28 September 2009, at 9:42 PM
Regards
Comment 36 written by Raymond Camden on 28 September 2009, at 10:08 PM
@Misty: It only returns 25 if you don't set a max attribute. You can set it to 50. Also, look at the result query. It tells you how many total items there are. With that, you can build your own pagination.
Comment 37 written by Shaveta on 28 September 2009, at 11:02 PM
Comment 38 written by Misty on 29 September 2009, at 12:55 AM
i am fetching the gettopratedvideos, when i run it, it just returns 25 results, if u can show me a viable example here, I shall be nice. i wanna get all results and show like 1 to 10 of 3773438 results:, then i can add my pagination. currently i am bit confused as there seems to me no result query in cfc which does that stuff
Comment 39 written by Raymond Camden on 29 September 2009, at 6:17 AM
Comment 40 written by Raymond Camden on 29 September 2009, at 6:47 AM
Comment 41 written by Shaveta on 29 September 2009, at 7:58 AM
the error i encountered is
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
Element ENTRY.CONTENT.XMLTEXT is undefined in ARGUMENTS.
The error occurred in C:\inetpub\wwwroot\project2\admin\com\youtube.cfc: line 392
Called from C:\inetpub\wwwroot\project2\admin\com\youtube.cfc: line 167
Called from C:\inetpub\wwwroot\project2\admin\com\youtube.cfc: line 83
Called from C:\inetpub\wwwroot\project2\playlist.cfm: line 8
390 : <cfset s.categories = categoryList>
391 : <cfset s.title = arguments.entry.title.xmlText>
392 : <cfset s.content = arguments.entry.content.xmlText>
393 : <cfset s.author = arguments.entry.author.name.xmlText>
394 : <cfset s.authorurl = entry.author.uri.xmlText>
Comment 42 written by Raymond Camden on 29 September 2009, at 8:06 AM
Comment 43 written by shaveta on 29 September 2009, at 8:06 AM
<cfset yt = createObject("component", "youtube")>
<cfset pl = yt.getPlaylists("PhilipDeFranco")>
<cfdump var="#pl#">
<cfif pl.recordCount>
<cfset plurl = pl.url[1]>
<cfdump var="#yt.getPlaylist(plurl)#">
</cfif>
Error i got
Element FEED.ENTRY is undefined in RESULT.
The error occurred in C:\inetpub\wwwroot\project2\admin\com\youtube.cfc: line 98
96 : <cfhttp url="#baseurl#" result="result">
97 : <cfset result = xmlParse(result.filecontent)>
98 : <cfif not arrayLen(result.feed.entry)>
99 : <cfreturn results>
100 : </cfif>
Comment 44 written by shaveta on 29 September 2009, at 8:10 AM
test_getplaylists.cfm and ran it but encountered above errors. if i change the users' name it shows
Element FEED.ENTRY is undefined in RESULT. error.
i have changed nothing in youtube.cfc code. i am just running it as copied from your demo folder and that's it
Comment 45 written by Raymond Camden on 29 September 2009, at 11:39 AM
http://www.coldfusionjedi.com/downloads/youtubecfc....
Please download and confirm. Once you do, I will update the main project.
Comment 46 written by shaveta on 29 September 2009, at 11:43 AM
Please check the url again for download
Regards
Comment 47 written by shaveta on 29 September 2009, at 11:44 AM
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Comment 48 written by Raymond Camden on 29 September 2009, at 11:46 AM
http://www.coldfusionjedi.com/downloads/youtube.se...
Comment 49 written by shaveta on 29 September 2009, at 12:11 PM
Comment 50 written by Raymond Camden on 29 September 2009, at 12:14 PM
Comment 51 written by Misty on 29 September 2009, at 8:29 PM
just let me know one example like gettopratedtags video or any other. it should all videos not only 25 please
Comment 52 written by Raymond Camden on 29 September 2009, at 8:34 PM
Comment 53 written by Misty on 29 September 2009, at 9:38 PM
while i am trying to get all related to that function gettoprated
Comment 54 written by Raymond Camden on 29 September 2009, at 9:40 PM
Comment 55 written by Misty on 29 September 2009, at 10:00 PM
suppose 100 topratedvideos are listed on youtube, i ran query it just returned 25. i have added pagination but it has restricted itself to 25 only, while i want the ful youtube 100 listings as on youtube. The same is the case with all queries.
Maybe i am able to clarify what exactly my point is
Comment 56 written by Raymond Camden on 29 September 2009, at 10:07 PM
Comment 57 written by Misty on 29 September 2009, at 10:46 PM
I am happy i am able to pinpoint my message clearly to you
Cheers
Comment 58 written by Raymond Camden on 30 September 2009, at 8:08 AM
http://www.coldfusionjedi.com/downloads/youtube.se...
It contains updates to support max/start for the 'top' video type searches. Note max still has a MAX value of 100.
Comment 59 written by Misty on 30 September 2009, at 8:20 PM
Comment 60 written by Misty on 30 September 2009, at 9:07 PM
i mean API does not go beyong 50 records for every function
Comment 61 written by Raymond Camden on 30 September 2009, at 9:08 PM
Comment 62 written by Misty on 30 September 2009, at 10:12 PM
getTopratedvideos("jshjsdsd",1,50)
it retur 50 recs
if try
getTopratedvideos("jshjsdsd",1,100)
it automatically comes to 25
so i have checked it does fetch more than 50, maybe issue with youtube api fetching results
Comment 63 written by Raymond Camden on 30 September 2009, at 10:14 PM
Comment 64 written by Misty on 30 September 2009, at 10:18 PM
Comment 65 written by Raymond Camden on 30 September 2009, at 10:21 PM
Comment 66 written by Misty on 1 October 2009, at 2:03 AM
now if i use like this:
<cfset query = #yt.getVideosBySearch("song",1,50)#>
Element FEED is undefined in PACKET.
if i remove 1,50, it shows records but only 25. i think i have very hard time locating this that if i return total of 1000000. i can use it can get max of 50 in one shift and that shift also needs pagination to say 10 in a row.
question arises. when it reached end of the 50, how does it know to run th cfc again to get another. i think i am doing wrong
Comment 67 written by Misty on 1 October 2009, at 2:10 AM
Comment 68 written by Raymond Camden on 1 October 2009, at 6:38 AM
Comment 69 written by Raymond Camden on 1 October 2009, at 8:14 AM
http://youtubecfc.riaforge.org
I've updated it there.
Comment 70 written by Misty on 1 October 2009, at 1:48 PM
i am correct, but exactly i do not know how this can be done
Comment 71 written by Raymond Camden on 1 October 2009, at 1:51 PM
http://www.coldfusionjedi.com/index.cfm/2006/4/24/...
If you google for ColdFusion and Pagination, you will see other examples. This is not a Youtube specific issue. Pagination can be done to any set of data, and there are many examples out there, not just the blog entry I linked to above.
Comment 72 written by Misty on 1 October 2009, at 10:12 PM
i tried to make it simple by means that rather than fetching 50 first time and paginate, why not fetch 10 at a time and then paginate, but issue persists, how to fetch the next 10 after first 10.
Comment 73 written by Raymond Camden on 1 October 2009, at 10:16 PM
If I'm still not reading you right... well, I hate to say I give up, but the language barrier is difficult here.
Comment 74 written by Misty on 1 October 2009, at 10:33 PM
Comment 75 written by Raymond Camden on 1 October 2009, at 10:35 PM
Comment 76 written by Misty on 1 October 2009, at 11:19 PM
suppose there is a method which does not have start and max attributes, can i add to it/
Comment 77 written by Misty on 2 October 2009, at 5:28 AM
Regards
Comment 78 written by Raymond Camden on 2 October 2009, at 6:22 AM
Comment 79 written by Misty on 2 October 2009, at 10:14 AM
so i tried the start and max in the url also but still no luck as:
abc.cfm?start=1&max=10&pagenumber=2
but it did not worked either way too
Comment 80 written by Raymond Camden on 2 October 2009, at 10:19 AM
I really think you need to look at the blog entry I mentioned before as it _does_ explain this concept.
Comment 81 written by Misty on 2 October 2009, at 10:50 AM
Comment 82 written by Misty on 2 October 2009, at 11:02 AM
how i rerun the cfc again to fetch next 25 or 50 recs,
I am going my blow my balls away with a shotgun! i am too much confused
:((
Comment 83 written by Raymond Camden on 2 October 2009, at 9:57 PM
_Thats_ how the CFC is run the 2nd time. The first time the user hits the page, url.start doesn't exist, so it defaults to 1, right? You determine there are more than 50 records so you build a link (again, look at the article), and now url.start is 51 and that is passed to the CFC.
Comment 84 written by Misty on 2 October 2009, at 11:49 PM
<cfset perpage = 10>
<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt toprated.recordCount or round(url.start) neq url.start>
<cfset url.start = 1>
<cfif StructKeyExists(URL,'time')>
<cfset tr = #yt.getTopRatedVideos("#url.time#",#url.start#,50)#>
<cfelse>
<cfset tr = #yt.getTopRatedVideos("")#>
</cfif>
</cfif>
but it does seems to work, i think i am missing one big step, i am near the end but can't find the end
Comment 85 written by Misty on 2 October 2009, at 11:57 PM
now running pagination on 25 or 50 is easy and it works, how it should fetch next 50.
because pagination has toprated.recordcount which is count to every time 50 or 25, so it is possible it keeps on fetching the very next records. seems impossible to me instead
Comment 86 written by Misty on 3 October 2009, at 1:17 AM
That all
Comment 87 written by Misty on 3 October 2009, at 1:42 AM
http://gdata.youtube.com/feeds/api/standardfeeds/t...
it clearly indicated that it cannot go and fetch the records, max 50 allowed, so i think there is no way how it can done.
Comment 88 written by Misty on 7 October 2009, at 11:55 AM
Comment 89 written by Raymond Camden on 7 October 2009, at 11:58 AM
Comment 90 written by ewilkinson on 17 October 2009, at 5:57 PM
I downloaded version 6 from RIAForge early last week, I'm wondering if I have the latest version. Thanks again for the great CFC's.
Cheers,
Eric Wilkinson
Comment 91 written by Raymond Camden on 18 October 2009, at 9:36 AM
Anyway, I took your changes as is and pushed it live. Download and check it out please.
Comment 92 written by Anthony on 17 November 2009, at 4:14 AM
I'm trying to use the "update" function of youtube.cfc. When I do, I get a 400 / Explanatioin: Bad Request error.
Here is the code that I'm using:
<cfset yt = createObject("component", "/yt/youtube")>
<cfset yt.setDeveloperKey("mykey")>
<cfset yt.login("uname", "pword")>
<cfset r = yt.update('#form.cause_name#','#form.before_description#','Music','#cause.tags#','#cause.before_video_ytid#')>
Here are the values to the above:
form.cause_name = sample cause
form.before_description = This is a test description.
cause.tags = Online, Contribution
cause.before_video_ytid = my video id displays here...
I checked the URLs and they seem to be correct, not sure what else to try. Any help is greatly appreciated!
- Anthony
Comment 93 written by Raymond Camden on 17 November 2009, at 5:08 PM
Comment 94 written by Anthony on 17 November 2009, at 6:32 PM
<cfset yt = createObject("component", "/yt/youtube")>
<cfset yt.setDeveloperKey("mykey")>
<cfset yt.login("uname", "pword")>
<cfset r = yt.update('Test Name','This is a description','Music','Testing','videoidvalue')>
Comment 95 written by Raymond Camden on 18 November 2009, at 8:27 AM
Comment 96 written by Raymond Camden on 18 November 2009, at 8:46 AM
Comment 97 written by Anthony on 30 November 2009, at 7:49 PM
Can you maybe provide me with a sample code? I may be missing something.
Thanks again!
Comment 98 written by Raymond Camden on 1 December 2009, at 5:01 PM
[Add Comment] [Subscribe to Comments]