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 Promise = require('bluebird');
|
||||||
const fs = require('fs').promises;
|
const fs = require('fs').promises;
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const bhttp = require('bhttp');
|
||||||
const nanoid = require('nanoid/non-secure');
|
const nanoid = require('nanoid/non-secure');
|
||||||
const mime = require('mime');
|
const mime = require('mime');
|
||||||
// const fileType = require('file-type');
|
// const fileType = require('file-type');
|
||||||
|
@ -371,9 +372,12 @@ async function fetchSource(source) {
|
||||||
const extension = mime.getExtension(mimetype);
|
const extension = mime.getExtension(mimetype);
|
||||||
const type = mimetype?.split('/')[0] || 'image';
|
const type = mimetype?.split('/')[0] || 'image';
|
||||||
|
|
||||||
const res = await http.get(source.src, {
|
const res = await bhttp.get(source.src, {
|
||||||
...(source.referer && { referer: source.referer }),
|
headers: {
|
||||||
...(source.host && { host: source.host }),
|
...(source.referer && { referer: source.referer }),
|
||||||
|
...(source.host && { host: source.host }),
|
||||||
|
},
|
||||||
|
stream: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
|
|
Loading…
Reference in New Issue