1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Cannot find an embed for this URL

Discussão em 'Python' iniciado por Stack, Setembro 27, 2024 às 18:32.

  1. Stack

    Stack Membro Participativo

    I'm working on a Wagtail project and trying to add embedded videos (from Vimeo) to my home page using EmbedBlock. However, I'm unable to embed any video links through the Wagtail admin. I’ve tried embedding videos in EmbedBlock, RichTextField and URLField, but none of them work.

    I don’t get any specific error messages—just: Cannot find embed for this URL and The page could not be saved due to validation errors

    Has anyone experienced this or know how to fix it? Any help would be appreciated! Thanks!

    here is my models.py:

    from wagtail import blocks
    from wagtail.models import Page
    from wagtail.fields import RichTextField, StreamField
    from wagtail.admin.panels import FieldPanel
    from wagtail.images.blocks import ImageChooserBlock
    from wagtail.embeds.blocks import EmbedBlock

    class ImageAndEmbedBlock(blocks.StreamBlock):
    image = ImageChooserBlock(required=False)
    video = EmbedBlock(required=False)

    class Meta: # noqa
    label = "Media"


    class HomePage(Page):
    body = RichTextField(blank=True)
    carousel = StreamField(ImageAndEmbedBlock(), null=True, blank=True)

    content_panels = Page.content_panels + [FieldPanel("body"), FieldPanel("carousel")]


    I tried adding this to the settings but it made no difference:

    # commented out the import because it did not work neither
    # from wagtail.embeds.oembed_providers import vimeo

    vimeo = {
    "endpoint": "https://www.vimeo.com/api/oembed.{format}",
    "urls": [
    r"^https?://(?:www\.)?vimeo\.com/.+$",
    r"^https?://player\.vimeo\.com/.+$",
    ],
    }

    WAGTAILEMBEDS_FINDERS = [
    {
    "class": "wagtail.embeds.finders.oembed",
    "providers": [vimeo],
    }
    ]

    Continue reading...

Compartilhe esta Página