From 16f183c117de2545676df0649190ccdf509e9b86 Mon Sep 17 00:00:00 2001 From: Xaekai Date: Sat, 22 Jan 2022 20:00:00 -0800 Subject: [PATCH] Add BitChute support --- player/update.coffee | 1 + src/get-info.js | 11 +++++++++++ src/utilities.js | 2 ++ www/js/util.js | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/player/update.coffee b/player/update.coffee index 62c15753..8ebb2873 100644 --- a/player/update.coffee +++ b/player/update.coffee @@ -14,6 +14,7 @@ TYPE_MAP = sb: StreamablePlayer tc: TwitchClipPlayer cm: VideoJSPlayer + bc: VideoJSPlayer pt: PeerPlayer window.loadMediaPlayer = (data) -> diff --git a/src/get-info.js b/src/get-info.js index 1a73f694..4b4f5ddc 100644 --- a/src/get-info.js +++ b/src/get-info.js @@ -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 = { diff --git a/src/utilities.js b/src/utilities.js index 5ffc4bea..acf9ea25 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -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 ""; } diff --git a/www/js/util.js b/www/js/util.js index 8a117f1d..022fe933 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -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 */