mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
YT: be a little more quiet about some errors
Some errors are to be expected for some videos. Quietly use fallback methods for them without printing those errors.
This commit is contained in:
@@ -373,7 +373,8 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
|
|
||||||
const hlsUri = info.streamingData.hlsManifestUrl;
|
const hlsUri = info.streamingData.hlsManifestUrl;
|
||||||
if(!hlsUri) {
|
if(!hlsUri) {
|
||||||
debug(new Error('no HLS manifest URL'));
|
/* HLS may be unavailable on finished live streams */
|
||||||
|
debug('no HLS manifest URL');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,8 +467,16 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
for(let stream of fmtArr) {
|
for(let stream of fmtArr) {
|
||||||
debug(`initial URL: ${stream.url}`);
|
debug(`initial URL: ${stream.url}`);
|
||||||
|
|
||||||
const result = await this._downloadDataPromise(stream.url, 'HEAD').catch(debug);
|
/* Errors in some cases are to be expected here,
|
||||||
if(!result) return null;
|
* so be quiet about them and use fallback methods */
|
||||||
|
const result = await this._downloadDataPromise(
|
||||||
|
stream.url, 'HEAD'
|
||||||
|
).catch(err => debug(err.message));
|
||||||
|
|
||||||
|
if(!result || !result.uri) {
|
||||||
|
debug('redirect could not be resolved');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
stream.url = Misc.encodeHTML(result.uri)
|
stream.url = Misc.encodeHTML(result.uri)
|
||||||
.replace('?', '/')
|
.replace('?', '/')
|
||||||
@@ -577,7 +586,7 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
return resolve(result);
|
return resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(new Error(`response code: ${statusCode}`));
|
debug(`response code: ${statusCode}`);
|
||||||
|
|
||||||
/* Internal Soup codes mean download aborted
|
/* Internal Soup codes mean download aborted
|
||||||
* or some other error that cannot be handled
|
* or some other error that cannot be handled
|
||||||
|
Reference in New Issue
Block a user