add: videoclip not working support

This commit is contained in:
ihatespawn 2024-06-02 13:58:02 +02:00
parent 2f4a013a2a
commit 6a78687a29
5 changed files with 52 additions and 1 deletions

View File

@ -188,6 +188,11 @@ export default async function(host, patternMatch, lang, obj) {
case "dailymotion": case "dailymotion":
r = await dailymotion(patternMatch); r = await dailymotion(patternMatch);
break; break;
case "videoclip":
r = await videoclip({
id: patternMatch.id
});
break;
case "loom": case "loom":
r = await loom({ r = await loom({
id: patternMatch.id id: patternMatch.id

View File

@ -99,6 +99,13 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
case "video": case "video":
switch (host) { switch (host) {
case "videoclip":
if (r.urls.endsWith(".m3u8")) {
params = { type: "render" }
} else {
responseType = "redirect";
}
break;
case "bilibili": case "bilibili":
params = { type: "render" }; params = { type: "render" };
break; break;

View File

@ -0,0 +1,31 @@
import { genericUserAgent } from "../../config.js";
export default async function({ id }) {
const modifiedId = id.split("_")[0]
const requestText = await fetch(`https://videoclip.bg/watch/${id}`, {
method: "GET",
headers: {
"user-agent": genericUserAgent
}
})
.then(req => {return req.text()})
.catch(() => {});
var videoTag = requestText.split('<video')[1];
var videoSource = videoTag.split(">")[1].split('<source')[1].split('"')[1].split('//')[1];
if (videoSource.endsWith(".mpd")) {
var videoSource = videoTag.split(">")[2].split('<source')[1].split('"')[1].split('//')[1];
} else if (!videoSource.endsWith(".mp4")) {
return { error: 'ErrorCouldntFetch'};
}
if (videoSource) {
return {
urls: "https://" + videoSource,
filename: `videoclip_${modifiedId}.mp4`,
audioFilename: `videoclip_${modifiedId}_audio`
}
}
return { error: 'bErrorEmptyDownload' }
}

View File

@ -1,6 +1,6 @@
{ {
"audioIgnore": ["vk", "ok", "loom"], "audioIgnore": ["vk", "ok", "loom"],
"hlsExceptions": ["dailymotion", "vimeo", "rutube"], "hlsExceptions": ["dailymotion", "vimeo", "rutube", "videoclip"],
"config": { "config": {
"bilibili": { "bilibili": {
"alias": "bilibili.com & bilibili.tv", "alias": "bilibili.com & bilibili.tv",
@ -118,6 +118,12 @@
"alias": "loom videos", "alias": "loom videos",
"patterns": ["share/:id"], "patterns": ["share/:id"],
"enabled": true "enabled": true
},
"videoclip": {
"alias": "loom videos",
"tld": "bg",
"patterns": ["watch/:id"],
"enabled": true
} }
} }
} }

View File

@ -1,4 +1,6 @@
export const testers = { export const testers = {
"videoclip": (patternMatch) => patternMatch.id?.match(/^[0-9]/),
"bilibili": (patternMatch) => "bilibili": (patternMatch) =>
patternMatch.comId?.length <= 12 || patternMatch.comShortLink?.length <= 16 patternMatch.comId?.length <= 12 || patternMatch.comShortLink?.length <= 16
|| patternMatch.tvId?.length <= 24, || patternMatch.tvId?.length <= 24,