Skip to content

YouTube API Data V3 and Google Authentication implementation for Django

License

Notifications You must be signed in to change notification settings

ivancrneto/youtube-django

Repository files navigation

youtube-django

docs Documentation Status
tests CircleCI codecov Codacy Badge Requirements Status
package PyPI Package latest release PyPI Wheel Supported versions Supported implementations Commits since latest release

Install

$ pip install youtube-django

Add 'youtube_django' to your settings.

INSTALLED_APPS = [
    # [...]
    'youtube_django',
]

Run migrations:

$ python manage.py migrate

Add the following Google Oauth Settings to your settings.py:

GOOGLE_OAUTH2_CLIENT_ID = '<Your Client ID from Google Developer Console>'
GOOGLE_OAUTH2_CLIENT_SECRET = '<Your Client Secret from Google Developer Console>'
GOOGLE_OAUTH2_CALLBACK_VIEW = 'oauth2callback'  # your oauth callback view name

Add your views.Example:

from youtube_django.views import (
    VideoUploadView,
    AuthorizeView,
    Oauth2CallbackView,
)

urlpatterns = [
    path('^yt/upload/', VideoUploadView.as_view(), name='video_upload'),
    path('^yt/authorize/', AuthorizeView.as_view(), name='authorize'),
    path('^yt/oauth2callback/', Oauth2CallbackView.as_view(),
        name='oauth2callback')
]