YT: do not check playability of saved temp data

Saved video info is always playable, otherwise its not saved in first place.
This commit is contained in:
Rafał Dzięgiel
2021-03-19 11:43:37 +01:00
parent 6dc825dfb3
commit b42843be1f

View File

@@ -119,7 +119,6 @@ var YouTubeClient = GObject.registerClass({
if(!result)
result = await this._getPlayerInfoPromise(videoId).catch(debug);
if(!result || !result.data) {
if(result && result.isAborted) {
debug(new Error('download aborted'));
@@ -129,7 +128,6 @@ var YouTubeClient = GObject.registerClass({
if(!result)
result = await this._getInfoPromise(videoId).catch(debug);
if(!result || !result.data) {
if(result && result.isAborted)
debug(new Error('download aborted'));
@@ -137,19 +135,14 @@ var YouTubeClient = GObject.registerClass({
break;
}
const invalidInfoMsg = (
!result.data.playabilityStatus
|| !result.data.playabilityStatus.status === 'OK'
)
? 'video is not playable'
: (!result.data.streamingData)
? 'video response data is missing streaming data'
: null;
if(!isFoundInTemp) {
const [isPlayable, reason] = this._getPlayabilityStatus(result.data);
if(invalidInfoMsg) {
debug(new Error(invalidInfoMsg));
if(!isPlayable) {
debug(new Error(reason));
break;
}
}
const info = this._getReducedInfo(result.data);
@@ -352,6 +345,20 @@ var YouTubeClient = GObject.registerClass({
});
}
_getPlayabilityStatus(info)
{
if(
!info.playabilityStatus
|| !info.playabilityStatus.status === 'OK'
)
return [false, 'video is not playable'];
if(!info.streamingData)
return [false, 'video response data is missing streaming data'];
return [true, null];
}
_getReducedInfo(info)
{
const reduced = {