Snippets

eSolution fiy_youtube_oembed.py

Created by Istvan Farkas
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.core.management import BaseCommand

from esolportal.embeddedvideo.models import EmbeddedVideo


class Command(BaseCommand):
    def handle(self, *args, **options):
        for o in EmbeddedVideo.objects.filter(embed_url__contains='youtube.com'):
            o.embed_url = o.embed_url.replace('http://www.youtube.com', 'https://www.youtube.com')
            print('Fixed %s' % o.embed_url)
            o.save()

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.