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 sb: StreamablePlayer
tc: TwitchClipPlayer tc: TwitchClipPlayer
cm: VideoJSPlayer cm: VideoJSPlayer
bc: VideoJSPlayer
pt: PeerPlayer pt: PeerPlayer
window.loadMediaPlayer = (data) -> window.loadMediaPlayer = (data) ->

View file

@ -7,6 +7,7 @@ const mediaquery = require("@cytube/mediaquery");
const YouTube = require("@cytube/mediaquery/lib/provider/youtube"); const YouTube = require("@cytube/mediaquery/lib/provider/youtube");
const Vimeo = require("@cytube/mediaquery/lib/provider/vimeo"); const Vimeo = require("@cytube/mediaquery/lib/provider/vimeo");
const PeerTube = require("@cytube/mediaquery/lib/provider/peertube"); 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 Streamable = require("@cytube/mediaquery/lib/provider/streamable");
const TwitchVOD = require("@cytube/mediaquery/lib/provider/twitch-vod"); const TwitchVOD = require("@cytube/mediaquery/lib/provider/twitch-vod");
const TwitchClip = require("@cytube/mediaquery/lib/provider/twitch-clip"); 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 = { module.exports = {

View file

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

View file

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