From b6b183e5dcbbb6a0162369c5e7299f41067b7fc9 Mon Sep 17 00:00:00 2001 From: Abhishek <88230286+Abhii5496@users.noreply.github.com> Date: Mon, 8 Apr 2024 10:28:59 +0000 Subject: [PATCH 1/4] instagram regex change - now it support both reel and post --- src/services.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services.js b/src/services.js index d15fc02d..acdccf84 100644 --- a/src/services.js +++ b/src/services.js @@ -129,11 +129,18 @@ export default { id: (ids) => ids.join('/embed/'), }, instagram: { - regex: /https?:\/\/www\.instagram\.com\/p\/([^\/\?\&]+)\/?.*/, + //it support both reel and post + regex: /^https:\/\/(?:www\.)?instagram\.com\/(?:reel|p)\/(.*)/, embedUrl: 'https://www.instagram.com/p/<%= remote_id %>/embed', html: '', height: 505, width: 400, + id: (groups) => { + if (groups.length > 0) { + const item = groups[0].split("/"); + return item[0]; + } + }, }, twitter: { regex: /^https?:\/\/(www\.)?twitter\.com\/.+\/status\/(\d+)/, From b77b681df6c4d5be54fd43f1dd1f2603b9a79a4f Mon Sep 17 00:00:00 2001 From: lazydev <88230286+Abhii5496@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:08:14 +0000 Subject: [PATCH 2/4] test added --- test/services.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/services.js b/test/services.js index e1e37b26..111c393d 100644 --- a/test/services.js +++ b/test/services.js @@ -286,6 +286,23 @@ describe('Services Regexps', () => { source: 'https://www.instagram.com/p/CfQzzGNphD8/?utm_source=ig_web_copy_link', embed: 'https://www.instagram.com/p/CfQzzGNphD8/embed' }, + { + source: 'https://www.instagram.com/p/C4_Lsf1NBra/?img_index=1', + embed: 'https://www.instagram.com/p/C4_Lsf1NBra/embed' + }, + { + source: 'https://www.instagram.com/p/C5ZZUWPydSY/?utm_source=ig_web_copy_link', + embed: 'https://www.instagram.com/p/C5ZZUWPydSY/embed' + }, + { + source: 'https://www.instagram.com/reel/C19IuqJx6wm/', + embed: 'https://www.instagram.com/p/C19IuqJx6wm/embed' + }, + { + source: 'https://www.instagram.com/reel/C19IuqJx6wm/?utm_source=ig_web_copy_link', + embed: 'https://www.instagram.com/p/C19IuqJx6wm/embed' + }, + ]; urls.forEach(url => { From ba3ccc38c2106765523279319234af3746a5d482 Mon Sep 17 00:00:00 2001 From: Abhishek <88230286+Abhii5496@users.noreply.github.com> Date: Wed, 9 Oct 2024 07:29:28 +0000 Subject: [PATCH 3/4] resolved conflict & updated code --- src/services.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/services.ts b/src/services.ts index 15d31ec5..79115930 100644 --- a/src/services.ts +++ b/src/services.ts @@ -137,12 +137,7 @@ const SERVICES: ServicesConfigType = { html: '', height: 505, width: 400, - id: (groups) => { - if (groups.length > 0) { - const item = groups[0].split("/"); - return item[0]; - } - }, + id: (groups: string[]) => groups?.[0]?.split("/")[0], }, twitter: { regex: /^https?:\/\/(www\.)?(?:twitter\.com|x\.com)\/.+\/status\/(\d+)/, From a64fec68b671b4de0ca551fd933cba4c136b3a12 Mon Sep 17 00:00:00 2001 From: Abhishek <88230286+Abhii5496@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:14:56 +0530 Subject: [PATCH 4/4] patch version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e768d7c0..8f1565d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/embed", - "version": "2.7.4", + "version": "2.7.5", "keywords": [ "codex editor", "embed",