Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Fix - Incorrect youtube video URL
Browse files Browse the repository at this point in the history
regex update and cleanup
  • Loading branch information
przemyslawpluta committed Feb 14, 2014
1 parent 17c4214 commit 954df15
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fs.exists(file, function(exists) {

var progressRegex = /(\d+(?:\.\d)?)% of (\d+\.\d+\w+) at\s+([^\s]+) ETA ((\d|-)+:(\d|-)+)/;

var isYouTubeRegex = /^(https?:\/\/www\.|https?:\/\/)?(youtube\.com|youtu\.be)\//;
var isYouTubeRegex = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\//;

// check if win
var isWin = /^win/.test(process.platform);
Expand Down Expand Up @@ -52,10 +52,8 @@ exports.download = function(urladdr, dest, args) {
// Get possible IDs.
var id = query.v || '';

// Check for youtube video url.
var isYouTube = isYouTubeRegex.test(urladdr);

if (isYouTube && !id) {
// Check for long and short youtube video url.
if (!id && isYouTubeRegex.test(urladdr)) {
// Get possible IDs for youtu.be from urladdr.
id = details.pathname.slice(1);
}
Expand Down

0 comments on commit 954df15

Please sign in to comment.