mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
YT: reduce amount of temp data stored per video
This commit is contained in:
@@ -136,30 +136,22 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const info = result.data;
|
|
||||||
|
|
||||||
const invalidInfoMsg = (
|
const invalidInfoMsg = (
|
||||||
!info.playabilityStatus
|
!result.data.playabilityStatus
|
||||||
|| !info.playabilityStatus.status === 'OK'
|
|| !result.data.playabilityStatus.status === 'OK'
|
||||||
)
|
)
|
||||||
? 'video is not playable'
|
? 'video is not playable'
|
||||||
: (!info.streamingData)
|
: (!result.data.streamingData)
|
||||||
? 'video response data is missing streaming data'
|
? 'video response data is missing streaming data'
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if(invalidInfoMsg) {
|
if(invalidInfoMsg) {
|
||||||
this.lastInfo = null;
|
|
||||||
|
|
||||||
debug(new Error(invalidInfoMsg));
|
debug(new Error(invalidInfoMsg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we have all formats arrays,
|
const info = this._getReducedInfo(result.data);
|
||||||
* so we will not have to keep checking */
|
|
||||||
if(!info.streamingData.formats)
|
|
||||||
info.streamingData.formats = [];
|
|
||||||
if(!info.streamingData.adaptiveFormats)
|
|
||||||
info.streamingData.adaptiveFormats = [];
|
|
||||||
|
|
||||||
if(this._getIsCipher(info.streamingData)) {
|
if(this._getIsCipher(info.streamingData)) {
|
||||||
debug('video requires deciphering');
|
debug('video requires deciphering');
|
||||||
@@ -360,6 +352,28 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getReducedInfo(info)
|
||||||
|
{
|
||||||
|
const reduced = {
|
||||||
|
videoDetails: {
|
||||||
|
videoId: info.videoDetails.videoId,
|
||||||
|
title: info.videoDetails.title,
|
||||||
|
lengthSeconds: info.videoDetails.lengthSeconds,
|
||||||
|
isLiveContent: info.videoDetails.isLiveContent
|
||||||
|
},
|
||||||
|
streamingData: info.streamingData
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Make sure we have all formats arrays,
|
||||||
|
* so we will not have to keep checking */
|
||||||
|
if(!reduced.streamingData.formats)
|
||||||
|
reduced.streamingData.formats = [];
|
||||||
|
if(!reduced.streamingData.adaptiveFormats)
|
||||||
|
reduced.streamingData.adaptiveFormats = [];
|
||||||
|
|
||||||
|
return reduced;
|
||||||
|
}
|
||||||
|
|
||||||
_getPlayerInfoPromise(videoId)
|
_getPlayerInfoPromise(videoId)
|
||||||
{
|
{
|
||||||
const data = this._getPlayerPostData(videoId);
|
const data = this._getPlayerPostData(videoId);
|
||||||
|
Reference in New Issue
Block a user