We’ve recently had an opportunity to create quite an interesting project. The client came asking whether or not I’d be able to create an automatic YouTube video uploader combined with WooCommerce products, created as WordPress plugin, the idea was to:
- Use the site uploaded video as the source.
- Upload the video to YouTube using YouTube API.
- Append the uploaded Video embed at the end of the WooCommerce product content.
- Shorten the product URL during the product creation.
Our idea to tackle the project was following:
- Use a URL shortening service to create short link and store it within a meta key of each product.
- Create separate page for YouTube authentication and store the authentication session until the default token expiration.
- If authenticated fetch the path of the media file and upload it to YouTube.
- In case of success append it to the end of the content.
- Flag the video (inside a meta key) as uploaded to avoid concurrent uploads.
The site may be found atΒ https://www.indiasropa.com/. The attached gallery shows image samples of a simple Back End panel extension to create the result.