Skip to content

Commit

Permalink
fix: Check null value for channelMatch within getAuthor from utils (#350
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kelyvin authored and fent committed Aug 3, 2018
1 parent cecac8c commit 5001469
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/util.js
Expand Up @@ -371,7 +371,7 @@ exports.getVideoDescription = (html) => {

/**
* Get video media (extra information) from html
*
*
* @param {String} body
* @return {Object}
*/
Expand Down Expand Up @@ -416,13 +416,13 @@ exports.getAuthor = (body) => {
const userMatch = ownerinfo.match(aliasRegexp);
const verifiedMatch = ownerinfo.match(verifiedRegexp);
return {
id: channelMatch[1],
name: channelMatch[2],
id: channelMatch ? channelMatch[1] : null,
name: channelMatch ? channelMatch[2] : null,
avatar: url.resolve(VIDEO_URL, exports.between(ownerinfo,
'data-thumb="', '"')),
verified: !!verifiedMatch && !!verifiedMatch[1],
user: userMatch ? userMatch[1] : null,
channel_url: 'https://www.youtube.com/channel/' + channelMatch[1],
channel_url: channelMatch ? 'https://www.youtube.com/channel/' + channelMatch[1] : null,
user_url: userMatch ? 'https://www.youtube.com/user/' + userMatch[1] : null,
};
};
Expand Down

0 comments on commit 5001469

Please sign in to comment.