Youtube uploader – wordpress plugin

I needed a plugin for uploading videos to youtube, directly from wordpress administration area using youtube upload API. Since none of the plugins i searched suited my needs i decided to write my own plugin.

Here are the key features of this plugin:

  • It uses browser based uploading (no traffic is wasted moving the video first to the blog, and after that to youtube)
  • It doesn’t use any external libraries to make it work
  • Youtube authentification is separate for each user, preventing conflicts when running in a multi-user environment
  • You can login using either youtube username / password or token session

Requirements:

  • Curl library
  • Allow_url_fopen switched on
  • Youtube API developer key

More instructions can be found in the readme.txt from the attached file.

Download youtubeuploader plugin

Encourage the development of this plugin:


No related posts.

60 Responses to “Youtube uploader – wordpress plugin”

  1. Dylan says:

    Love this plug-in idea. Great work!

    i get the following error:
    Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration in /nfs/c04/h05/mnt/12345/domains/domain.com/html/wp-content/plugins/youtube-uploader/youtube_uploader.class.php on line 120

    Warning: simplexml_load_file(http://gdata.youtube.com/schemas/2007/categories.cat) [function.simplexml-load-file]: failed to open stream: no suitable wrapper could be found in /nfs/c04/h05/mnt/12345/domains/domain.com/html/wp-content/plugins/youtube-uploader/youtube_uploader.class.php on line 120

    Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity “http://gdata.youtube.com/schemas/2007/categories.cat” in /nfs/c04/h05/mnt/12345/domains/domain.com/html/wp-content/plugins/youtube-uploader/youtube_uploader.class.php on line 120

    Fatal error: Call to a member function getNamespaces() on a non-object in /nfs/c04/h05/mnt/12345/domains/domain.com/html/wp-content/plugins/youtube-uploader/youtube_uploader.class.php on line 121

    —————–

    Is there a fix for this without turning on allow_url_fopen in my php.ini?

    Thanks!

  2. dan says:

    Thank you for your feedback
    The solution is to replace:

    $xml = simplexml_load_file($url);

    with

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result['output'] = curl_exec($ch);
    $xml = simplexml_load_string($result['output']);

    in youtube_uploader.class.php
    method getCategories().

    I updated the code on this post, and should be also updated on wordpress site shortly.

  3. Dylan says:

    Worked perfect!

  4. Mac says:

    Dan, I love you! :D
    (not exactly, but similar ;)
    I asked this plugin to many developers and all said that was a good idea, but noone made.
    THANKS! Can’t wait to try it! :)

    Can I suggest a feature that should solve a great problem with WPMS?
    Add a flag that permit to a WPMS admin to allow users to insert videos only in mainsite account, not specifically in personal one, adding tags as username (as default) to retrieve movies :)
    (I have also some ideas regarding this plugins, if you want, write me)
    And, please, add a Donate button to your page :)
    Thanks again a lot

    Mac

  5. dan says:

    Thanks. I will consider your requests for the next version (also the donate button :) ). I first have to do some research about WPMS, as i have developed and tested using WP.
    I am always interested in making the plugin better, if you want you can share your ideas on the comments page or by using the contact form.

  6. Mac says:

    Sorry for delay.
    For example, there is a good plugin: “Youtube with style” that works well but it’s not updated and don’t include the upload function.
    Youtube Uploader and Youtube with style together, with their semplicity of use and integration, could be a win win plugin to manage movies in WP3

    More or less in the same days that you released your great plugin, another developer relased one, for pay.
    Thanks a lot to share your for free ;)

  7. Mac says:

    If I use the plugin as administrator, no problems, but if I try it as editor, an alert say that need to enter a developer key that, of course, has been already entered and working for admin.
    I’m talking about trying to upload a movie, clicking on the right tab, no form shown, only this message.
    Any idea?
    Thanks in advance

  8. dan says:

    You are right, only the users that had “manage_options” rights (administrators) could modify their youtube uploader auth data. I changed that and now all the users with “upload_files” right (administrators,editors and authors) can change their youtube uploader auth data.
    In the next major release, which i plan to launch early next week, i will let the administrator decide which group of users have the rights to upload the videos to youtube.
    As for your other request “Add a flag that permit to a WPMS admin to allow users to insert videos only in mainsite account, not specifically in personal one, adding tags as username (as default) to retrieve movies”, it can be done but it should be in another plugin, as youtube uploader only handles inserting a video embed code from uploads into the current post, it does not handle post publish options.
    I will look into youtube with style to see which ideas i can use.

  9. Mac says:

    Hi Dan,
    “youtube uploader only handles inserting a video embed code from uploads into the current post, it does not handle post publish options”, in fact, may be I explained myself badly.
    When I say “adding tags as username (as default) to retrieve movies” I mean “to retrieve in future, with a movie publisher plugin” like Youtube with style or another one.
    If a MS admin have the possibility to assign a default tag (like username) or may be also a custom one, after, for the user, will be easy to retrieve his own movie between all uploaded on admin channel.
    Hope now be more clear.
    Youtube uploader and YWS works perfectly together, but, for sure, have them integrated could be a better plugin. This is one case where 1+1=3 :)
    Also, have a Yotube Uploader link under Media menu, in administration, could help.

  10. Jeff Fischer says:

    Of all the plugins i use this is the one i need the most.

    Having it work properly will save me so much time and bandwidth. The problem is that the second i activate the plugin my site crashes and all i get is a page of code in it’s place.

    http://files.mythica.org/halo/highimpacthalo/highspeed/Tutorials/YoutubeUploaderError.rtf

    Once i delete the Youtube Uploader files my site works fine.

    allow_url_fopen = On
    cURL support = enabled
    cURL Information = libcurl/7.19.5 OpenSSL/1.0.0 zlib/1.2.3 libssh2/1.2.5)

  11. dudu buzaglo says:

    hey Dan
    im using Wordpress ver 3.1 with Hebrew support
    after activate the admin crush until i delete the plugin directory.
    do you have any idea?

  12. Ida Bah says:

    Hi amazing web log, I noticed your site when study on how to improve my site. I was just now inquiring what spam software you use for comments as I get a great deal on my blog.

  13. vishnu says:

    I have found an error
    Fatal error: Call to undefined function curl_init() in D:\xampp\htdocs\wordpress3\wp-content\plugins\youtube-uploader\youtube_uploader.class.php on line 179
    in that case there is any solution..?

  14. shakexx says:

    I have a javascript error from the flash uploader when trying to upload a video to Youtube.

    The error is:
    post_id is not defined

    I’m using WP 3.0.1 and youtube uploader 0.3 (the only active plugin)

    Someone else have the same problem? How can I solve it?
    There is an easy way to use the flash uploader from any frontend page and not from wp-admin?

    thanks a lot…

  15. samandjt says:

    Thanks for the plugin. I have been modifying it for use on our school’s WPMS 3.

    I am getting “This file exceeds the maximum upload size for this site.”

    Is it correct that the uploaded video needs to satisfy WP’s max size?

    If so, any suggestions for tweaking this?

    Thanks,

    Sam

  16. I’ve got the “Invalid youtube authentification” error when i’m trying to add some video :( The developer key is configured correctly.

  17. Marc Gratch says:

    Having the same problem of Dudu and Jeff. Any ideas?

  18. Jas says:

    Hi
    This plugin is great. Well Played.
    Many Thanks,
    Jas

  19. Dtv says:

    Looks promising but same error as Jeff mentioned. This is on windows 7 using XamPP

  20. Steak says:

    Hi, I got an error too:

    PHP Parse error: syntax error, unexpected T_ELSE in wp-content/plugins/youtube-uploader/media-upload.php on line 143

  21. Maverick says:

    Hi Dan! Can I use this plugin in a frontend of Wordpress? I need that users can uploads your video without enter in admin area

  22. Greater68 says:

    Would you add remote upload feature ( upload video by adding a link or upload video available on server to youtube ) ? I’m very interested this fearture.

    Best Regards !

  23. Kevin says:

    Hi Dan,

    This is exactly what I need! But when I go to upload, the media menu simply becomes a blank screen. I’m running the latest version of WP 3.0.4

    Any ideas?

    Thanks!

  24. Abubaker says:

    “Of all the plugins i use this is the one i need the most.

    Having it work properly will save me so much time and bandwidth. The problem is that the second i activate the plugin my site crashes and all i get is a page of code in it’s place.

    Once i delete the Youtube Uploader files my site works fine.”

    I am facing exactly the same problem. How can i rectify it ?

  25. Abubaker says:

    Alright.. I found the solution. You should allow/ON “short open tag” in PHP. Then the below problem will be solved
    —————————————————————————-
    “Of all the plugins i use this is the one i need the most.

    Having it work properly will save me so much time and bandwidth. The problem is that the second i activate the plugin my site crashes and all i get is a page of code in it’s place.

    Once i delete the Youtube Uploader files my site works fine.”

    —————————————————————————-

    Thats it!! It worked perfect. :-)

  26. Pat says:

    I have installed and configured the plugin and have added the developer key correctly. However, I don’t see how I give permissions to groups of user to allow them to upload. Is there a config setting I missed? Also, when are you supposed to see the screen shot 1?

  27. Lee says:

    Hey,
    Great plugin!! But I’m trying to emmbed my channel on a post http://www.confusedthoughts.com/2011/02/confused-thoughts-tube-channel/ and it wont show videos unless I assign them to a playlist. Is there a way to upload to a particular playlist? Thanks

  28. Brendan says:

    I am also looking for an uploader with front end functionality. I would be happy to make a generous donation to your efforts if you can implement this for me. Please email so we can discuss a few details.

    Cheers,

    Brendan

  29. I am having the same problem as Pawel. I am able to enter the information for the video I would like to upload, but when I click ‘next’ I get the message, “Invalid youtube authentification”. I believe I have set up the developer key correctly, though I did not generate a certificate on my site for Google. Is this a necessary step in order to get this plugin to work properly?

  30. Jeff Fischer says:

    Many thanks to Abubaker for the solution. The uploader now works fine… for me.

    Like some of the above posters i am trying to allow upload access to my site’s YouTube account for the other admins of my site. Having all of our videos in one YouTube account is absolutely essential but i can’t give them the password or key. Is there a way to disable the “Youtube authentification is separate for each user” feature and allow access to the YouTube account for all users with “upload_files” capabilities. I don’t mind altering the existing code but i don’t want to break anything. It is very unlikely that more than one user will be using the account at a time.

    I also want to keep the key hidden so the YouTube Uploader in the Settings panel can’t override Adminimize’s (plugin which hides features) attempt to hide it from lower users.

  31. mrmjct says:

    I have tried to install this but after switching on ’short open tag’ and enabling php_curl.dll I am getting the same problem as Pawel.

    It seems to be a problem with the iframe displaying auth.php. If you change auth.php to open in a new window and display the token, and change youtube-uploader.php to enable you to enter the token manually, it works.

    Then I get a problem with size of upload permitted and dimensions of the video so requires more work.

  32. Topher says:

    This plugin LOOKS exactly like what I want, but it seems to behave differently than advertised.

    When I upload it tells me my video is too large for the server’s (wordpress’s) 2M upload limit. I was under the impression it didn’t ever get uploaded to my server, but went straight to Youtube.

    I tried it on a server with a 30M upload limit and it worked, but then I had an flv in my media library rather than a youtube link.

    What am I doing wrong?

  33. John says:

    Hello,

    I entered the developer key and tried to link a YouTube Video.

    I got “Invalid youtube authentification”

    How do I solve this problem?

  34. elango says:

    hi great,work well in admin panel, but how to upload from user panel any idea.

  35. Adrian says:

    @Topher
    I got this and resolved by switching to the ‘Browser Uploader’ instead of the Flash. Hope this helps.

  36. Adrian says:

    Hiya –

    I’m working on adding ‘privacy’ settings to the plugin so I can upload an unlisted video.

    Using the tag….

    http://code.google.com/apis/youtube/2.0/developers_guide_protocol_uploading_videos.html#Assigning_Developer_Tags

    ….

    *But* not really sure where to add this. Any ideas? thanks!

  37. Patrik says:

    Hey folks, I did also get the Invalid youtube authentification, anyone who knows the problem and could solve it?

    //Patrik

  38. rob says:

    hi,
    great plugink works like a charm. im only missing the feature to upload videos as private and set them public later.
    is this possible somehow?
    it would be great
    thank you

  39. Sfera says:

    @Rob That’s exactly what i need, too, upload the videos, set them to private and when approved by admin set them to public state. Is this even possible? It would be a great feature. Anyway, it works great, thank you :)

  40. Pete says:

    plugin not allowing to upload 100mb file, get msg too big
    went to youtube and was able to upload, are we going to increase this?

  41. Himanshu says:

    Hello Dan,

    I just installed this plugin with my WordPress 3.2.1. installation.
    I was able to configure it through the settings.
    But when i try to edit or add a post i dont see any uploading tab anywhere.

    Please help
    Regards
    Himanshu

  42. Good put up! GA is also my greatest earning. Nevertheless, it’s not a much.

  43. Marcos says:

    Hello! I do not speak English as I understand little and also I’m not a programmer, so I came to ask where I have to put the “debeloper key” and I can not not understand we will find the place … Already thank you very much.

  44. Devin says:

    Love this plugin as it saves a tonne of time for the promo team for uploading videos, but the thing is, I need to be able to have users upload videos, and currently it says they have to enter an auth code?

  45. Reece says:

    I’ve been looking for something like this for ages! Just 1 question though, can I make this work without the need for Wordpress?

    I want to have people from the public send videos to my YouTube channel but I don’t want them having to log in or have access to the control panel.

  46. Delia says:

    Hi there, I guess this issue has something to do with the recents updates of Youtube.com site, cuz my plugin was running smooth on my site. But now when I try to upload a video, after filling the info fields and then selecting the video file for upload first it shows the “maximum size exceded” message (which I avoid switching to the regular uploader, instead of the flash uploader) and then when it finishes uploading the video file, what it now shows on screen is the last previous video and it doesnt upload the file or info I just entered.

    Any thoughts on what’s going wrong? i dont even have an error message or anything. It was showing the “$xml = simplexml_load_file($url);” error which I replaced with what you instruct here on blog.

    Anyone else having this issue?

  47. Jason says:

    I’m running into an issue with getting “Invalid youtube authentification” on upload attempts.

    Using the Auth Session Key, the session key doesn’t look to be stored in the usermeta table.

    Using the youtube user/pass, data is stored in usermeta table, but still results in the error.

    I’ve been attempting to debug it, any suggestions?

  48. caponx says:

    Does this work?

    When i try to authenticate it says “You cant show this content in a frame”
    but if i authenticate in another tab it works.

    However the youtube uploader tab is just blank with the latest wordpress.

    How to solve this?

  49. Junaid Ahmed says:

    If you are receiving blank page after video upload please goto
    /wp-content/plugins/youtube-uploader/media-upload.php
    and rename line number 3

    $new_tab = array(‘youtube_uploader’ => ‘Youtube uploader’);
    to
    $new_tab = array(‘youtube_html’ => ‘Youtube uploader’);

    thats it!

  50. Junaid Ahmed says:

    Apologies, but my above solution will not solve your problem, please revert your change, and do the following changes. (If possible mod can remove above comment)

    function youtube_wp_upload_tabs ($tabs)
    {
    $new_tab = array(‘youtube_uploader’ => ‘Youtube uploader’);
    $ret = array_merge($tabs,$new_tab);
    return $ret;
    }
    add_filter(‘media_upload_tabs’, ‘youtube_wp_upload_tabs’);

    function media_upload_youtube_uploader()
    {
    $s = $_GET['s'];

    if(!empty($s))
    {
    return wp_iframe(‘media_youtube_html’,$errors);
    }else{
    return wp_iframe( ‘media_youtube_uploader_form’, $errors );
    }
    }

    and then goto at line number 156
    Replace

    $html_action_url = $browser_upload['url'].’?nexturl=’.urlencode(admin_url(‘media-upload.php’).’?post_id=’.$_GET['post_id'].’&type=’.$_GET['type'].’&tab=youtube_uploader&html_upload=1′);

    to

    $html_action_url = $browser_upload['url'].’?nexturl=’.urlencode(admin_url(‘media-upload.php’).’?post_id=’.$_GET['post_id'].’&type=’.$_GET['type'].’&tab=youtube_uploader&html_upload=1&s=1′);

    Now Enjoy!

Leave a Reply