Set user-agent in ffprobe pre-flight check (#869)

This commit is contained in:
Calvin Montgomery 2020-05-17 10:22:43 -07:00
parent 88365612da
commit 529a3561ca
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.70.0", "version": "3.70.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -8,6 +8,8 @@ var path = require("path");
import { callOnce } from './util/call-once'; import { callOnce } from './util/call-once';
const CYTUBE_VERSION = require('../package.json').version;
const LOGGER = require('@calzoneman/jsli')('ffmpeg'); const LOGGER = require('@calzoneman/jsli')('ffmpeg');
const ECODE_MESSAGES = { const ECODE_MESSAGES = {
ENOTFOUND: e => ( ENOTFOUND: e => (
@ -155,8 +157,11 @@ function testUrl(url, cb, params = { redirCount: 0, cookie: '' }) {
var transport = (data.protocol === "https:") ? https : http; var transport = (data.protocol === "https:") ? https : http;
data.method = "HEAD"; data.method = "HEAD";
data.headers = {
'User-Agent': `CyTube/${CYTUBE_VERSION}`
};
if (cookie) { if (cookie) {
data.headers = { 'Cookie': cookie }; data.headers['Cookie'] = cookie;
} }
try { try {
@ -170,6 +175,7 @@ function testUrl(url, cb, params = { redirCount: 0, cookie: '' }) {
"on the website hosting the link. For best results, use " + "on the website hosting the link. For best results, use " +
"a direct link. See https://git.io/vrE75 for details."); "a direct link. See https://git.io/vrE75 for details.");
} }
const nextParams = { const nextParams = {
redirCount: redirCount + 1, redirCount: redirCount + 1,
cookie: cookie + getCookie(res) cookie: cookie + getCookie(res)