Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
Fix youtube.
Browse files Browse the repository at this point in the history
TIL two things: Youtube video ids can have underscores, and i broke
modifiers with this rewrite. Derp.
  • Loading branch information
mythmon committed Jan 12, 2013
1 parent 1a1d094 commit f2ba21e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions manager.js
Expand Up @@ -83,6 +83,12 @@ cycleScreen = function(screen_id) {
/* Put new content on the next screen in the line up. */
exports.setUrl = function(url, screen_name, callback) {
var screen;

if (screens.length === 0) {
utils.async(callback, {msg: 'No screens.'});
return;
}

if (screen_name) {
screen = findScreen('name', screen_name, true);
}
Expand Down
5 changes: 3 additions & 2 deletions modifiers.js
Expand Up @@ -10,13 +10,14 @@ exports.all.push(function blacklistNoodle(opts) {
}
});

var youtube_re = RegExp('(youtube.com/watch\\?v=([A-Za-z0-9]+))|(youtu.be/([A-Za-z0-9]+))');
var youtube_re = RegExp('(youtube.com/watch\\?v=([A-Za-z0-9_]+))|(youtu.be/([A-Za-z0-9]+))');
exports.all.push(function embedYoutube(opts) {
var match = youtube_re.exec(opts.url);
if (match) {
var id = match[2] || match[4];
return {
url: 'http://www.youtube.com/embed/' + id + '?rel=0&autoplay=1'
url: 'http://www.youtube.com/embed/' + id + '?rel=0&autoplay=1',
type: 'url'
};
}
});

0 comments on commit f2ba21e

Please sign in to comment.