forked from DebaucheryLibrarian/traxxx
Adding media streaming experiments.
This commit is contained in:
parent
4b26f8f476
commit
2cfbd21560
10
src/media.js
10
src/media.js
|
@ -4,6 +4,7 @@ const config = require('config');
|
|||
const Promise = require('bluebird');
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
const bhttp = require('bhttp');
|
||||
const nanoid = require('nanoid/non-secure');
|
||||
const mime = require('mime');
|
||||
// const fileType = require('file-type');
|
||||
|
@ -371,9 +372,12 @@ async function fetchSource(source) {
|
|||
const extension = mime.getExtension(mimetype);
|
||||
const type = mimetype?.split('/')[0] || 'image';
|
||||
|
||||
const res = await http.get(source.src, {
|
||||
...(source.referer && { referer: source.referer }),
|
||||
...(source.host && { host: source.host }),
|
||||
const res = await bhttp.get(source.src, {
|
||||
headers: {
|
||||
...(source.referer && { referer: source.referer }),
|
||||
...(source.host && { host: source.host }),
|
||||
},
|
||||
stream: true,
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
|
|
Loading…
Reference in New Issue