editor-js / embed

Embed Tool for Editor.js
MIT License
148 stars 107 forks source link

Embed doesn't recognise Instagram reels #92

Open Eliam93 opened 2 years ago

Eliam93 commented 2 years ago

Hi, I'm trying to embed a reel URL, but it doesn't work as for Ig posts. There is any chance to embed that? Thanks

kentarohorie commented 2 years ago

It seems that embedding not work when URL has query parameter.

https://www.instagram.com/p/CfQzzGNphD8/?utm_source=ig_web_copy_link -> not work https://www.instagram.com/p/CfQzzGNphD8/ -> work

kentarohorie commented 2 years ago

I made a mistake. My problem not relate with this issue.

Swanand01 commented 1 year ago
instagramPost: {
    regex: /https?:\/\/www\.instagram\.com\/p\/([^\/\?\&]+)\/?([\s\S]*)\/?/,
    embedUrl: "https://www.instagram.com/p/<%= remote_id %>/embed",
    html: '<iframe width="400" height="505" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',
    height: 505,
    width: 400,
    id: (groups) => {
        return groups[0];
    }
}
instagramReel: {
    regex: /https?:\/\/www\.instagram\.com\/reel\/([^\/\?\&]+)\/?([\s\S]*)\/?/,
    embedUrl: "https://www.instagram.com/reel/<%= remote_id %>/embed",
    html: '<iframe width="400" height="600" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',
    height: 600,
    width: 400,
    id: (groups) => {
        return groups[0];
    }
}

These two configs worked for me. You'll have to add these to the config object when you instantiate the EditorJS object.