From 6bdfa73734cbd150bc5f359dbc8230a3b41f0d2d Mon Sep 17 00:00:00 2001 From: Eridanus Sora Date: Mon, 29 Apr 2019 19:59:14 +0800 Subject: [PATCH] defaults to use socks5h --- package.json | 2 +- src/core/parsers/nico.ts | 4 ++-- src/core/parsers/nicolive.ts | 2 +- src/utils/m3u8.ts | 2 +- src/utils/media.ts | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index fed5a31..e263366 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minyami", - "version": "2.2.1", + "version": "2.2.2", "description": "", "main": "index.js", "scripts": { diff --git a/src/core/parsers/nico.ts b/src/core/parsers/nico.ts index 72f8f06..745340c 100644 --- a/src/core/parsers/nico.ts +++ b/src/core/parsers/nico.ts @@ -87,7 +87,7 @@ export default class Parser { 'Cookie': downloader.cookies, 'User-Agent': UA.CHROME_DEFAULT_UA }, - httpsAgent: downloader.proxy ? new SocksProxyAgent(`socks5://${downloader.proxyHost}:${downloader.proxyPort}`) : undefined, + httpsAgent: downloader.proxy ? new SocksProxyAgent(`socks5h://${downloader.proxyHost}:${downloader.proxyPort}`) : undefined, }) const token = response.data.data.streamServer.url.match(/ht2_nicolive=(.+)/)[1]; const host = response.data.data.streamServer.url.match(/(http(s):\/\/.+\/)/)[1]; @@ -112,7 +112,7 @@ export default class Parser { socketUrl = `wss://a.live2.nicovideo.jp/unama/wsapi/v1/watch/${liveId}/timeshift?audience_token=${downloader.key}`; } if (downloader.proxy) { - const agent = new SocksProxyAgent(`socks5://${downloader.proxyHost}:${downloader.proxyPort}`); + const agent = new SocksProxyAgent(`socks5h://${downloader.proxyHost}:${downloader.proxyPort}`); socket = new ReconnectingWebSocket(socketUrl, { agent }, { diff --git a/src/core/parsers/nicolive.ts b/src/core/parsers/nicolive.ts index d6571c4..f1ebbfb 100644 --- a/src/core/parsers/nicolive.ts +++ b/src/core/parsers/nicolive.ts @@ -26,7 +26,7 @@ export default class Parser { socketUrl = `wss://a.live2.nicovideo.jp/unama/wsapi/v1/watch/${liveId}/timeshift?audience_token=${downloader.key}`; } if (downloader.proxy) { - const agent = new SocksProxyAgent(`socks5://${downloader.proxyHost}:${downloader.proxyPort}`); + const agent = new SocksProxyAgent(`socks5h://${downloader.proxyHost}:${downloader.proxyPort}`); socket = new ReconnectingWebSocket(socketUrl, { agent }, { diff --git a/src/utils/m3u8.ts b/src/utils/m3u8.ts index 18276ff..4fedcb1 100644 --- a/src/utils/m3u8.ts +++ b/src/utils/m3u8.ts @@ -15,7 +15,7 @@ export async function loadM3U8(Log:Logger, path: string, retries: number = 1, ti try { const response = await axios.get(path, { timeout, - httpsAgent: proxy ? new SocksProxyAgent(`socks5://${proxy.host}:${proxy.port}`) : undefined, + httpsAgent: proxy ? new SocksProxyAgent(`socks5h://${proxy.host}:${proxy.port}`) : undefined, headers: { 'User-Agent': UA.CHROME_DEFAULT_UA, 'Host': new URL(path).host diff --git a/src/utils/media.ts b/src/utils/media.ts index e5d998f..2d2667b 100644 --- a/src/utils/media.ts +++ b/src/utils/media.ts @@ -78,7 +78,7 @@ export function download(url: string, path: string, proxy: AxiosProxyConfig = un url, method: 'GET', responseType: 'arraybuffer', - httpsAgent: proxy ? new SocksProxyAgent(`socks5://${proxy.host}:${proxy.port}`) : undefined, + httpsAgent: proxy ? new SocksProxyAgent(`socks5h://${proxy.host}:${proxy.port}`) : undefined, headers: { 'User-Agent': UA.CHROME_DEFAULT_UA, 'Host': new URL(url).host @@ -115,7 +115,7 @@ export async function requestRaw(url: string, proxy: AxiosProxyConfig = undefine method: 'GET', responseType: 'stream', timeout: 60000, - httpsAgent: proxy ? new SocksProxyAgent(`socks5://${proxy.host}:${proxy.port}`) : undefined, + httpsAgent: proxy ? new SocksProxyAgent(`socks5h://${proxy.host}:${proxy.port}`) : undefined, headers: { 'User-Agent': UA.CHROME_DEFAULT_UA, 'Host': new URL(url).host