Browse Source

Add 'axiosAdapter' parameter

master
KaKi87 7 months ago
parent
commit
9e01a5ba18
  1. 10
      index.js

10
index.js

@ -2,10 +2,16 @@ const
axios = require('axios'),
userAgents = require('user-agents');
module.exports = ({ domain = 'invidious.snopyta.org' } = {}) => {
module.exports = ({
domain = 'invidious.snopyta.org',
axiosAdapter
} = {}) => {
const
rootUrl = `https://${domain}`,
_axios = axios.create({ baseURL: `${rootUrl}/api/v1` });
_axios = axios.create({
baseURL: `${rootUrl}/api/v1`,
adapter: axiosAdapter
});
_axios.defaults.headers.common['User-Agent'] = userAgents.random().toString();
return {
instance: { getInfo: async () => (await _axios('stats')).data },

Loading…
Cancel
Save