Skip to content

Commit

Permalink
Fixed issue with url parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
thelevicole committed Nov 5, 2020
1 parent c6e29e9 commit e8b0829
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/YouTubeToHtml5.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "youtube-to-html5-loader",
"version": "1.1.0",
"version": "1.1.1",
"devDependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
Expand Down
2 changes: 1 addition & 1 deletion src/YouTubeToHtml5.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ YouTubeToHtml5.prototype.itagMap = {
YouTubeToHtml5.prototype.urlToId = function( url ) {
const regex = /^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|(?:(?:youtube-nocookie\.com\/|youtube\.com\/)(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/)))([a-zA-Z0-9\-_]*)/;
const matches = url.match( regex );
return matches[ 1 ] || url;
return Array.isArray( matches ) && matches[ 1 ] ? matches[ 1 ] : url;
};

/**
Expand Down

0 comments on commit e8b0829

Please sign in to comment.