mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] updates premiumize moch
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
const needle = require('needle');
|
||||
const magnet = require('magnet-uri');
|
||||
const { getRandomProxy, getProxyAgent, getRandomUserAgent } = require('../lib/requestHelper');
|
||||
const { cacheWrapProxy } = require('../lib/cache');
|
||||
const { getRandomUserAgent } = require('../lib/requestHelper');
|
||||
const { getTorrent } = require('../lib/repository');
|
||||
const { Type } = require('../lib/types');
|
||||
|
||||
@@ -33,10 +32,7 @@ async function getMagnetLink(infoHash) {
|
||||
}
|
||||
|
||||
async function initBestTrackers() {
|
||||
const userAgent = getRandomUserAgent();
|
||||
const proxy = await cacheWrapProxy('moch', () => getRandomProxy()).catch(() => getRandomProxy());
|
||||
const agent = getProxyAgent(proxy);
|
||||
const options = { timeout: 30000, agent: agent, headers: { 'User-Agent': userAgent } };
|
||||
const options = { timeout: 30000, headers: { 'User-Agent': getRandomUserAgent() } };
|
||||
|
||||
BEST_TRACKERS = await needle('get', TRACKERS_URL, options)
|
||||
.then(response => response.body && response.body.trim())
|
||||
@@ -46,6 +42,7 @@ async function initBestTrackers() {
|
||||
return [];
|
||||
});
|
||||
ALL_TRACKERS = BEST_TRACKERS.concat(ANIME_TRACKERS);
|
||||
console.log('Retrieved best trackers: ', BEST_TRACKERS);
|
||||
}
|
||||
|
||||
module.exports = { initBestTrackers, getAllTrackers, getMagnetLink };
|
||||
@@ -25,7 +25,7 @@ function manifest(config = {}) {
|
||||
.map(moch => moch.name)
|
||||
.join(' & ');
|
||||
const possibleMochs = Object.values(MochOptions).map(moch => moch.name).join('/')
|
||||
const mochsDesc = enabledMochs ? ` and ${enabledMochs} enabled ` : '';
|
||||
const mochsDesc = enabledMochs ? ` and ${enabledMochs} enabled` : '';
|
||||
return {
|
||||
id: 'com.stremio.torrentio.addon',
|
||||
version: '0.0.7',
|
||||
|
||||
@@ -23,7 +23,7 @@ function getRandomProxy() {
|
||||
}
|
||||
|
||||
function getProxyAgent(proxy) {
|
||||
return new HttpsProxyAgent(proxy);
|
||||
return proxy && new HttpsProxyAgent(proxy);
|
||||
}
|
||||
|
||||
function blacklistProxy(proxy) {
|
||||
|
||||
Reference in New Issue
Block a user