whatsthis
Version:
Discover embedable content from URL's
33 lines (26 loc) • 880 B
JavaScript
;
var embedframe = require('../embedframe');
/**
* Detect if the given URL is an Twitch.TV clip.
*
* @param {Result} result Result of message parsing.
* @param {Function} next Continuation callback.
* @private
*/
module.exports = function youtube(result, next) {
if ('clips.twitch.tv' !== result.url.hostname) {
return next();
}
// <iframe
// src="https://clips.twitch.tv/embed?clip=breezypeazy/LongRavenFrankerZ&autoplay=false"
// width="640" height="360" frameborder="0" scrolling="no"
// allowfullscreen="true"></iframe>"
//
// https://clips.twitch.tv/breezypeazy/LongRavenFrankerZ
result.url.set('query', { autoplay: 'false', clip: result.url.pathname });
result.url.set('pathname', '/embed');
result.type = 'video';
result.service = 'twitch';
result.html = embedframe(result.url.href);
return next(undefined, true);
};