@elice/material-video 1.240627.0 → 1.240628.0-emptyhistory.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,14 @@
1
1
  'use strict';
2
2
 
3
- const YOUTUBE_DOMAIN = 'https://www.youtube.com';
4
- const YOUTUBE_SHORT_DOMAIN = 'https://youtu.be';
5
- const YOUTUBE_VIDEO_ID_LENGTH = 11;
6
3
  /**
7
4
  * Get YouTube video id from url using regex
8
5
  * @param url URL of youtube
9
6
  * @returns id of youtube video OR null when URL is invalid
10
7
  */
11
8
  const youtubeUrlParser = url => {
12
- var _a, _b;
13
- const pattern = new RegExp(`^(?:${YOUTUBE_DOMAIN}/watch\\?v=|${YOUTUBE_DOMAIN}/embed/|${YOUTUBE_SHORT_DOMAIN}/)(?<videoId>[^?&]+)`);
14
- const match = pattern.exec(url);
15
- if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.videoId.length) === YOUTUBE_VIDEO_ID_LENGTH) {
16
- return (_b = match.groups) === null || _b === void 0 ? void 0 : _b.videoId;
17
- }
18
- return null;
9
+ const regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
10
+ const match = regExp.exec(url);
11
+ return match && match[7].length === 11 ? match[7] : null;
19
12
  };
20
13
 
21
14
  exports.youtubeUrlParser = youtubeUrlParser;
@@ -1,19 +1,12 @@
1
- const YOUTUBE_DOMAIN = 'https://www.youtube.com';
2
- const YOUTUBE_SHORT_DOMAIN = 'https://youtu.be';
3
- const YOUTUBE_VIDEO_ID_LENGTH = 11;
4
1
  /**
5
2
  * Get YouTube video id from url using regex
6
3
  * @param url URL of youtube
7
4
  * @returns id of youtube video OR null when URL is invalid
8
5
  */
9
6
  const youtubeUrlParser = url => {
10
- var _a, _b;
11
- const pattern = new RegExp(`^(?:${YOUTUBE_DOMAIN}/watch\\?v=|${YOUTUBE_DOMAIN}/embed/|${YOUTUBE_SHORT_DOMAIN}/)(?<videoId>[^?&]+)`);
12
- const match = pattern.exec(url);
13
- if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.videoId.length) === YOUTUBE_VIDEO_ID_LENGTH) {
14
- return (_b = match.groups) === null || _b === void 0 ? void 0 : _b.videoId;
15
- }
16
- return null;
7
+ const regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
8
+ const match = regExp.exec(url);
9
+ return match && match[7].length === 11 ? match[7] : null;
17
10
  };
18
11
 
19
12
  export { youtubeUrlParser };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-video",
3
- "version": "1.240627.0",
3
+ "version": "1.240628.0-emptyhistory.0",
4
4
  "description": "User view and editing components of Elice material video",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -49,8 +49,8 @@
49
49
  "@elice/icons": "^1.230814.0",
50
50
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
51
51
  "@elice/intl": "0.240425.0-rc.2",
52
- "@elice/material-shared-types": "1.240627.0",
53
- "@elice/material-shared-utils": "1.240627.0",
52
+ "@elice/material-shared-types": "1.240628.0-emptyhistory.0",
53
+ "@elice/material-shared-utils": "1.240628.0-emptyhistory.0",
54
54
  "@elice/types": "^1.240619.0",
55
55
  "@types/classnames": "^2.3.1",
56
56
  "@types/react": "~17.0.9",
@@ -59,5 +59,5 @@
59
59
  "react-use": "^17.2.4",
60
60
  "styled-components": "^5.3.0"
61
61
  },
62
- "gitHead": "cae3cf992700ae62935ac3e4bb1213ffdca1e181"
62
+ "gitHead": "68530a3319448a7d3a4a60360c6d42663547cd33"
63
63
  }