Skip to Content
Menu

YouTube Video Auto Posting

by
Odoo
v 18.0 Third Party 10
Download for v 18.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 296
Technical Name youtube_auto_post
LicenseLGPL-3
Websitehttps://devscodespace.com
Versions 15.0 16.0 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 296
Technical Name youtube_auto_post
LicenseLGPL-3
Websitehttps://devscodespace.com
Versions 15.0 16.0 17.0 18.0

Installation and Configuration Guide for YouTube Auto Post Odoo Addon

Overview

The youtube_auto_post Odoo addon enables users to schedule and automate video uploads to YouTube using the YouTube Data API. Key features include:

  • Uploading videos stored as Odoo attachments (ir.attachment).
  • Scheduling uploads via Odoo's cron job.
  • Managing YouTube API credentials (client_secrets.json) through a settings interface.
  • Handling OAuth 2.0 authentication to generate a token_youtube_v3.pickle file.

Prerequisites

  • Odoo Installation: Odoo 18. See Odoo Documentation.
  • Python Environment: A Python environment with Odoo dependencies installed.
  • Google Cloud Account: Sign up at Google Cloud Console.
  • Video Files: Must be in MP4, MOV, or AVI formats and stored as Odoo attachments.
  • System Requirements: Write permissions for the Odoo addons directory and an internet connection.
  • Admin Access: Access to Odoo’s settings menu (requires base.group_system permissions).

Step 1: Set Up Google Cloud and Create client_secrets.json

1.1 Create a Google Cloud Project

- Visit Google Cloud Console.
- Click New Project, enter a name (e.g., youtubeAutoPost), and click Create.
- Select the project from the top dropdown.

1.2 Enable YouTube Data API

- Go to APIs & Services > Library.
- Search for YouTube Data API v3 and click Enable.
- See YouTube Data API Documentation.

1.3 Create OAuth 2.0 Credentials

- Navigate to APIs & Services > Credentials.
- Click Create Credentials > OAuth 2.0 Client IDs.
- Select Desktop app, enter a name (e.g., YouTube Upload Client), and click Create.
- Download the client_secrets.json file by clicking the download icon.

1.4 Configure OAuth Consent Screen

- Go to APIs & Services > OAuth consent screen.
- Select External and click Create.
- Fill in:

  • App name: youtubeAutoPost
  • User support email: Your email.
  • Developer contact information: Your email.
- Under Scopes, ensure https://www.googleapis.com/auth/youtube.upload is included.
- Under Test users, add the Google account email you’ll use for YouTube uploads to avoid the "Access blocked" error.
- Save and set to Testing mode.

1.5 Verify Your YouTube Account (Optional)

- For videos longer than 15 minutes, verify your YouTube account at YouTube Verification.
- See YouTube Upload Guidelines.

Step 2: Install the Odoo Addon

2.1 Install Python Dependencies

Run in your Odoo Python environment:

pip install google-api-python-client google-auth-oauthlib google-auth-httplib2

2.2 Install the Addon

- Copy the youtube_auto_post addon folder to your custom addons directory (e.g., /path/to/custom/addons/youtube_auto_post).
- Alternatively, scaffold the module:

cd /path/to/odoo
./odoo-bin scaffold youtube_auto_post /path/to/custom/addons
Replace generated files with provided addon files. See Odoo Module Development.
- Create a static/ folder:
mkdir -p /path/to/custom/addons/youtube_auto_post/static
chmod -R u+w /path/to/custom/addons/youtube_auto_post/static

2.3 Update Odoo Configuration

Edit odoo.conf:

[options]
addons_path = /path/to/odoo/addons,/path/to/custom/addons

2.4 Install in Odoo

- Start/restart Odoo:

./odoo-bin -c /path/to/odoo.conf
- Enable Developer Mode (Settings > Activate the developer mode).
- Go to Apps > Update Apps List, search for YouTube Video Auto Posting, and click Install or Upgrade.

Step 3: Configure the Addon in Odoo

3.1 Upload client_secrets.json

- Log in as an admin user (base.group_system permissions).
- Go to Settings > YouTube API Settings.
- Upload the client_secrets.json file (from Google Cloud Console) in the Client Secrets JSON field.
- Save the record.

3.2 Authenticate with YouTube

- Go to Website > Configuration > YouTube Uploads.
- Create a new record and fill in:

  • Title: Video title for YouTube.
  • Description: Optional description.
  • Tags: Comma-separated (e.g., video,odoo,automation).
  • Category: Select a category (e.g., People & Blogs). See YouTube Video Categories.
  • Privacy Status: public, private, or unlisted.
  • Video File: Attach an MP4, MOV, or AVI file.
  • Schedule Date: Optional date/time for scheduled uploads.
- Click Upload Now.
- A browser window will open for OAuth authentication. Sign in with the Google account added as a test user (Step 1.4) and authorize the app.
- The addon generates token_youtube_v3.pickle in youtube_auto_post/static/.

3.3 Configure the Scheduler

- The cron job runs every 15 minutes to process scheduled uploads.
- Adjust the schedule in Settings > Technical > Automation > Scheduled Actions under YouTube Video Upload.

Step 4: Use the Addon

4.1 Manual Upload

- Create a record in YouTube Uploads, attach a video, and click Upload Now.
- Check the YouTube Video ID and Status fields.

4.2 Scheduled Upload

- Set a Schedule Date, click Schedule Upload, and wait for the cron job.
- Verify the upload via YouTube Video ID and Status.

4.3 View on YouTube

- Access the video at https://www.youtube.com/watch?v=VIDEO_ID.

Troubleshooting

Common Issues

  • "Access blocked: youtubeAutoPost has not completed the Google verification process":
    - Add the Google account as a test user in Google Cloud Console > OAuth consent screen > Test users.
    - Delete token_youtube_v3.pickle:
    rm /path/to/custom/addons/youtube_auto_post/static/token_youtube_v3.pickle
  • No .pickle File:
    - Verify client_secrets.json is uploaded in YouTube API Settings.
    - Check permissions:
    chmod -R u+w /path/to/custom/addons/youtube_auto_post/static
  • File Format Errors: Ensure videos are MP4, MOV, or AVI.
  • Quota Limits: Uploads use ~1,600 units of 10,000 daily quota. Request an increase at Google Cloud Console. See YouTube API Quota.
  • Cron Not Running: Verify the scheduled action in Settings > Technical > Scheduled Actions.

Debugging

- Check Odoo logs:

./odoo-bin -c /path/to/odoo.conf --log-level=debug
- Ensure YouTube Data API is enabled in Google Cloud Console.

Security Notes

- Protect token_youtube_v3.pickle:

chmod 600 /path/to/custom/addons/youtube_auto_post/static/token_youtube_v3.pickle
- Restrict client_secrets.json access to admin users in Odoo.
- Ensure the static/ folder is not publicly accessible.

Additional Notes

  • Video Length: Up to 12 hours or 256 GB if verified at YouTube Verification.
  • Production Use: Submit for Google verification in Google Cloud Console. See Google API Verification.
  • Customization: Extend the addon for additional features. See Odoo Module Development.
  • Support: Visit YouTube Data API Documentation or Odoo Community Forums.

Created by https://devscodespace.com/

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.