match: add freebind support for youtube and instagram
This commit is contained in:
parent
0114e686b8
commit
c306a944d9
2 changed files with 19 additions and 2 deletions
|
@ -41,5 +41,8 @@
|
|||
"undici": "^6.7.0",
|
||||
"url-pattern": "1.0.3",
|
||||
"youtubei.js": "^9.3.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"freebind": "^0.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,21 @@ import streamable from "./services/streamable.js";
|
|||
import twitch from "./services/twitch.js";
|
||||
import rutube from "./services/rutube.js";
|
||||
import dailymotion from "./services/dailymotion.js";
|
||||
import { env } from '../config.js';
|
||||
|
||||
let freebind;
|
||||
export default async function(host, patternMatch, url, lang, obj) {
|
||||
assert(url instanceof URL);
|
||||
let dispatcher, requestIP;
|
||||
|
||||
if (env.freebindCIDR) {
|
||||
if (!freebind) {
|
||||
freebind = await import('freebind');
|
||||
}
|
||||
|
||||
requestIP = freebind.ip.random(env.freebindCIDR);
|
||||
dispatcher = freebind.dispatcherFromIP(requestIP, { strict: false });
|
||||
}
|
||||
|
||||
try {
|
||||
let r, isAudioOnly = !!obj.isAudioOnly, disableMetadata = !!obj.disableMetadata;
|
||||
|
@ -66,7 +78,8 @@ export default async function(host, patternMatch, url, lang, obj) {
|
|||
format: obj.vCodec,
|
||||
isAudioOnly: isAudioOnly,
|
||||
isAudioMuted: obj.isAudioMuted,
|
||||
dubLang: obj.dubLang
|
||||
dubLang: obj.dubLang,
|
||||
dispatcher
|
||||
}
|
||||
|
||||
if (url.hostname === 'music.youtube.com' || isAudioOnly === true) {
|
||||
|
@ -122,7 +135,8 @@ export default async function(host, patternMatch, url, lang, obj) {
|
|||
case "instagram":
|
||||
r = await instagram({
|
||||
...patternMatch,
|
||||
quality: obj.vQuality
|
||||
quality: obj.vQuality,
|
||||
dispatcher
|
||||
})
|
||||
break;
|
||||
case "vine":
|
||||
|
|
Loading…
Reference in a new issue