Add BitChute support

This commit is contained in:
Xaekai 2022-01-22 20:00:00 -08:00 committed by Calvin Montgomery
parent ba80c1591d
commit 16f183c117
4 changed files with 22 additions and 0 deletions

View file

@ -14,6 +14,7 @@ TYPE_MAP =
sb: StreamablePlayer
tc: TwitchClipPlayer
cm: VideoJSPlayer
bc: VideoJSPlayer
pt: PeerPlayer
window.loadMediaPlayer = (data) ->

View file

@ -7,6 +7,7 @@ const mediaquery = require("@cytube/mediaquery");
const YouTube = require("@cytube/mediaquery/lib/provider/youtube");
const Vimeo = require("@cytube/mediaquery/lib/provider/vimeo");
const PeerTube = require("@cytube/mediaquery/lib/provider/peertube");
const BitChute = require("@cytube/mediaquery/lib/provider/bitchute");
const Streamable = require("@cytube/mediaquery/lib/provider/streamable");
const TwitchVOD = require("@cytube/mediaquery/lib/provider/twitch-vod");
const TwitchClip = require("@cytube/mediaquery/lib/provider/twitch-clip");
@ -387,6 +388,16 @@ var Getters = {
}
},
/* BitChute */
bc: function (id, callback) {
BitChute.lookup(id).then(video => {
video = new Media(video.id, video.title, video.duration, "bc", video.meta);
callback(null, video);
}).catch(error => {
callback(error.message || error);
});
},
};
module.exports = {

View file

@ -208,6 +208,8 @@
case "pt":
const [domain,uuid] = id.split(';');
return `https://${domain}/videos/watch/${uuid}`;
case "bc":
return `https://www.bitchute.com/video/${id}/`;
default:
return "";
}

View file

@ -58,6 +58,8 @@ function formatURL(data) {
} else {
return `https://${data.meta.embed.domain}/w/${data.meta.embed.short}`;
}
case "bc":
return `https://www.bitchute.com/video/${data.id}/`;
default:
return "#";
}
@ -1389,6 +1391,12 @@ function parseMediaLink(url) {
if(data.pathname == '/open'){
return { type: 'gd', id: data.searchParams.get('id') }
}
case 'bitchute.com':
if(data.pathname.startsWith('/video/')){
return { type: 'bc', id: `${data.pathname.slice(7).split('/').shift()}` }
}
}
/* PeerTubes */