Skip to content

Commit

Permalink
defaults to use socks5h
Browse files Browse the repository at this point in the history
  • Loading branch information
Last-Order committed Apr 29, 2019
1 parent 0c94e3c commit 6bdfa73
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minyami",
"version": "2.2.1",
"version": "2.2.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/core/parsers/nico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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
}, {
Expand Down
2 changes: 1 addition & 1 deletion src/core/parsers/nicolive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}, {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/m3u8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/utils/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6bdfa73

Please sign in to comment.