Skip to content

Instantly share code, notes, and snippets.

View devsutong's full-sized avatar
🖥️
developing

Ymphaidien Sutong devsutong

🖥️
developing
  • Center for Development of Advanced Computing, Noida
  • Shillong, India
  • X @devsutong
View GitHub Profile
@devsutong
devsutong / jwt_auth.py
Last active December 31, 2021 22:50
JWT Authentication Middleware for Django v3 and Channels v3
from channels.db import database_sync_to_async
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from channels.middleware import BaseMiddleware
from channels.auth import AuthMiddlewareStack
from jwt import decode as jwt_decode
from django.conf import settings
User = get_user_model()

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track